Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC-1208: add RESP data type to received data log #148

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func defaultCallbacks(stageHarness *test_case_harness.TestCaseHarness, logPrefix
stageHarness.Logger.Debugf("%sReceived bytes: %q", logPrefix, string(bytes))
},
AfterReadValue: func(value resp_value.Value) {
stageHarness.Logger.Debugf("%sReceived RESP value: %s", logPrefix, value.FormattedString())
valueTypeLowerCase := strings.ReplaceAll(strings.ToLower(value.Type), "_", " ")
ryan-gang marked this conversation as resolved.
Show resolved Hide resolved
stageHarness.Logger.Debugf("%sReceived RESP %s: %s", logPrefix, valueTypeLowerCase, value.FormattedString())

},
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/resp/value/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (v *Value) FormattedString() string {
case ERROR:
return fmt.Sprintf("%q", "ERR: "+v.String())
case NIL:
return "NIL"
return "$-1\\r\\n"
}

return ""
Expand Down
40 changes: 20 additions & 20 deletions internal/test_helpers/fixtures/expiry/pass
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ Debug = true
[stage-7] $ redis-cli SET apple blueberry px 100
[stage-7] Sent bytes: "*5\r\n$3\r\nSET\r\n$5\r\napple\r\n$9\r\nblueberry\r\n$2\r\npx\r\n$3\r\n100\r\n"
[stage-7] Received bytes: "+OK\r\n"
[stage-7] Received RESP value: "OK"
[stage-7] Received RESP simple string: "OK"
[stage-7] Received "OK"
[stage-7] Received OK at 02:05:03.213
[stage-7] Fetching key "apple" at 02:05:03.213 (should not be expired)
[stage-7] Received OK at 00:14:54.979
[stage-7] Fetching key "apple" at 00:14:54.979 (should not be expired)
[stage-7] $ redis-cli GET apple
[stage-7] Sent bytes: "*2\r\n$3\r\nGET\r\n$5\r\napple\r\n"
[stage-7] Received bytes: "$9\r\nblueberry\r\n"
[stage-7] Received RESP value: "blueberry"
[stage-7] Received RESP bulk string: "blueberry"
[stage-7] Received "blueberry"
[stage-7] Sleeping for 101ms
[stage-7] Fetching key "apple" at 02:05:03.316 (should be expired)
[stage-7] Fetching key "apple" at 00:14:55.083 (should be expired)
[stage-7] $ redis-cli GET apple
[stage-7] Sent bytes: "*2\r\n$3\r\nGET\r\n$5\r\napple\r\n"
[stage-7] Received bytes: "$-1\r\n"
[stage-7] Received RESP value: NIL
[stage-7] Received NIL
[stage-7] Received RESP nil: $-1\r\n
ryan-gang marked this conversation as resolved.
Show resolved Hide resolved
[stage-7] Received $-1\r\n
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully
Expand All @@ -31,13 +31,13 @@ Debug = true
[stage-6] $ redis-cli SET blueberry raspberry
[stage-6] Sent bytes: "*3\r\n$3\r\nSET\r\n$9\r\nblueberry\r\n$9\r\nraspberry\r\n"
[stage-6] Received bytes: "+OK\r\n"
[stage-6] Received RESP value: "OK"
[stage-6] Received RESP simple string: "OK"
[stage-6] Received "OK"
[stage-6] Getting key blueberry
[stage-6] $ redis-cli GET blueberry
[stage-6] Sent bytes: "*2\r\n$3\r\nGET\r\n$9\r\nblueberry\r\n"
[stage-6] Received bytes: "$9\r\nraspberry\r\n"
[stage-6] Received RESP value: "raspberry"
[stage-6] Received RESP bulk string: "raspberry"
[stage-6] Received "raspberry"
[stage-6] Test passed.
[stage-6] Terminating program
Expand All @@ -48,7 +48,7 @@ Debug = true
[stage-5] $ redis-cli ECHO pear
[stage-5] Sent bytes: "*2\r\n$4\r\nECHO\r\n$4\r\npear\r\n"
[stage-5] Received bytes: "$4\r\npear\r\n"
[stage-5] Received RESP value: "pear"
[stage-5] Received RESP bulk string: "pear"
[stage-5] Received "pear"
[stage-5] Test passed.
[stage-5] Terminating program
Expand All @@ -59,33 +59,33 @@ Debug = true
[stage-4] client-1: $ redis-cli PING
[stage-4] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-4] client-1: Received bytes: "+PONG\r\n"
[stage-4] client-1: Received RESP value: "PONG"
[stage-4] client-1: Received RESP simple string: "PONG"
[stage-4] Received "PONG"
[stage-4] client-2: $ redis-cli PING
[stage-4] client-2: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-4] client-2: Received bytes: "+PONG\r\n"
[stage-4] client-2: Received RESP value: "PONG"
[stage-4] client-2: Received RESP simple string: "PONG"
[stage-4] Received "PONG"
[stage-4] client-1: $ redis-cli PING
[stage-4] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-4] client-1: Received bytes: "+PONG\r\n"
[stage-4] client-1: Received RESP value: "PONG"
[stage-4] client-1: Received RESP simple string: "PONG"
[stage-4] Received "PONG"
[stage-4] client-1: $ redis-cli PING
[stage-4] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-4] client-1: Received bytes: "+PONG\r\n"
[stage-4] client-1: Received RESP value: "PONG"
[stage-4] client-1: Received RESP simple string: "PONG"
[stage-4] Received "PONG"
[stage-4] client-2: $ redis-cli PING
[stage-4] client-2: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-4] client-2: Received bytes: "+PONG\r\n"
[stage-4] client-2: Received RESP value: "PONG"
[stage-4] client-2: Received RESP simple string: "PONG"
[stage-4] Received "PONG"
[stage-4] client-1: Success, closing connection...
[stage-4] client-3: $ redis-cli PING
[stage-4] client-3: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-4] client-3: Received bytes: "+PONG\r\n"
[stage-4] client-3: Received RESP value: "PONG"
[stage-4] client-3: Received RESP simple string: "PONG"
[stage-4] Received "PONG"
[stage-4] client-2: Success, closing connection...
[stage-4] client-3: Success, closing connection...
Expand All @@ -98,17 +98,17 @@ Debug = true
[stage-3] client-1: $ redis-cli PING
[stage-3] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-3] client-1: Received bytes: "+PONG\r\n"
[stage-3] client-1: Received RESP value: "PONG"
[stage-3] client-1: Received RESP simple string: "PONG"
[stage-3] Received "PONG"
[stage-3] client-1: $ redis-cli PING
[stage-3] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-3] client-1: Received bytes: "+PONG\r\n"
[stage-3] client-1: Received RESP value: "PONG"
[stage-3] client-1: Received RESP simple string: "PONG"
[stage-3] Received "PONG"
[stage-3] client-1: $ redis-cli PING
[stage-3] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-3] client-1: Received bytes: "+PONG\r\n"
[stage-3] client-1: Received RESP value: "PONG"
[stage-3] client-1: Received RESP simple string: "PONG"
[stage-3] Received "PONG"
[stage-3] Success, closing connection...
[stage-3] Test passed.
Expand All @@ -121,7 +121,7 @@ Debug = true
[stage-2] $ redis-cli PING
[stage-2] Sent bytes: "*1\r\n$4\r\nPING\r\n"
[stage-2] Received bytes: "+PONG\r\n"
[stage-2] Received RESP value: "PONG"
[stage-2] Received RESP simple string: "PONG"
[stage-2] Received "PONG"
[stage-2] Test passed.
[stage-2] Terminating program
Expand Down