Repository navigation
Read an INFO reply the way Redis writes it, and print the log when it fails - #2
Merged
Merged
Conversation
… fails
The first build of this component died in its own conf script, with a
message that said no Redis answered INFO on [::1]:6379 after 30 tries. The
server was up, listening on both loopback families, and answering.
Redis speaks CRLF. Every line of an INFO reply ends "\r\n", redis-cli prints
the reply as it came, and the check was anchored with a dollar:
redis-cli INFO server | grep tcp_port | od -c
t c p _ p o r t : 6 3 7 9 \r \n
grep -q "^tcp_port:6379$" no match
tr -d '\r' | grep -qx "tcp_port:6379" match
Measured in the chroot of the failed build, which is also where the fix was
proved before this commit was written. The reply now goes through tr in one
function that both the wait and the per address check call, and the stub in
tests/conf.bats answers in CRLF, so every test in that file covers the real
shape rather than a convenient one. One test says so by name and asserts
both halves: that the dollar anchored form does not match, and that the
form this script uses does.
Two things the same failure showed about the script rather than about Redis.
The log went with the directory. The check runs the server in a scratch
directory and removes it on the way out, which took the server's own log
with it, so the build that failed could not be diagnosed from its own
output: the log had to be reproduced by hand in the tree fab left behind.
The fatal path prints its last twenty lines first now.
And the message was wrong in a way that sent the reading in the wrong
direction. "after 30 tries" belonged to the wait on [::1]; the check that
actually failed had made one attempt against one address. The two facts are
printed as two facts.
Nothing the image gets changes. Coverage stays at 100 percent on all three
measured files, 126 lines, 67 bats tests.
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.
Found by the first build of this component, on the build host, in its own conf script:
The server was up, listening on both loopback families, and answering.
Redis speaks CRLF
Every line of an
INFOreply ends\r\n, redis-cli prints the reply as it came, and the check was anchored with a dollar. Measured in the chroot of the failed build:The reply now goes through
trin one function both the wait and the per address check call. The stub intests/conf.batsanswers in CRLF now, so every test in that file covers the real shape rather than a convenient one; one test says so by name and asserts both halves.Two things the same failure showed about the script
[::1]; the check that failed had made one attempt against one address. Two facts, printed as two facts.Nothing the image gets changes.
versiongoes to 1.0.1 because the pin a recipe clones has to move.Coverage
100 percent on all three measured files, 126 of 126 lines, 67 bats tests (was 123/123 over 65).
Test plan
COVERAGE_THRESHOLD=100 tests/coverage.sh: 100/100/100redis-server 8.0.2in the chroot of the failed build before this was writtentests / coveragegreen here