Merged
Conversation
Otherwise when the test fails, the output is confusing, the expectation
is shown as "actual" and the other way round:
```
117s === RUN TestLatency
117s reply_test.go:273:
117s Error Trace: /tmp/autopkgtest-lxc.v59pdptr/downtmp/autopkgtest_tmp/_build/src/github.com/gomodule/redigo/redis/reply_test.go:273
117s Error: Not equal:
117s expected: redis.Latency{Name:"command", Time:time.Date(2025, time.March, 11, 2, 49, 58, 0, time.Local), Latest:6000000, Max:6000000}
117s actual : redis.Latency{Name:"command", Time:time.Date(2025, time.March, 11, 2, 49, 58, 0, time.Local), Latest:1000000, Max:1000000}
```
There's no guarantee that the latency will be 1ms exactly, it might be
longer, especially if the tests run on a busy machine.
This was spotted in the Debian automatic testing infrastructure:
```
70s === RUN TestLatency
70s reply_test.go:273:
70s Error Trace: /tmp/autopkgtest-lxc.slqiy8xs/downtmp/autopkgtest_tmp/_build/src/github.com/gomodule/redigo/redis/reply_test.go:273
70s Error: Not equal:
70s expected: redis.Latency{Name:"command", Time:time.Date(2025, time.March, 10, 22, 8, 39, 0, time.Local), Latest:2000000, Max:2000000}
70s actual : redis.Latency{Name:"command", Time:time.Date(2025, time.March, 10, 22, 8, 39, 0, time.Local), Latest:1000000, Max:1000000}
70s
70s Diff:
70s --- Expected
70s +++ Actual
70s @@ -15,4 +15,4 @@
70s },
70s - Latest: (time.Duration) 2000000,
70s - Max: (time.Duration) 2000000
70s + Latest: (time.Duration) 1000000,
70s + Max: (time.Duration) 1000000
70s }
70s Test: TestLatency
70s --- FAIL: TestLatency (0.00s)
70s === RUN TestLatencyHistories
70s reply_test.go:314:
70s Error Trace: /tmp/autopkgtest-lxc.slqiy8xs/downtmp/autopkgtest_tmp/_build/src/github.com/gomodule/redigo/redis/reply_test.go:314
70s Error: Not equal:
70s expected: 1ms
70s actual : 2ms
70s Test: TestLatencyHistories
70s --- FAIL: TestLatencyHistories (0.00s)
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Latency tests might fail on busy machines, as the actual latency is longer than expected.
Happens on the Debian build infrastructure: