Skip to content

Commit

Permalink
feat: update logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-gang committed May 28, 2024
1 parent c22f90c commit 9fcfee8
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func defaultCallbacks(stageHarness *test_case_harness.TestCaseHarness, logPrefix
},
AfterReadValue: func(value resp_value.Value) {
valueTypeLowerCase := strings.ReplaceAll(strings.ToLower(value.Type), "_", " ")
if valueTypeLowerCase == "nil" {
valueTypeLowerCase = "null bulk string"
}
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 "$-1\\r\\n"
return "\"$-1\\r\\n\""
}

return ""
Expand Down
10 changes: 5 additions & 5 deletions internal/test_helpers/fixtures/expiry/pass
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ Debug = true
[stage-7] Received bytes: "+OK\r\n"
[stage-7] Received RESP simple string: "OK"
[stage-7] Received "OK"
[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] Received OK at 20:39:57.019
[stage-7] Fetching key "apple" at 20:39:57.019 (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 bulk string: "blueberry"
[stage-7] Received "blueberry"
[stage-7] Sleeping for 101ms
[stage-7] Fetching key "apple" at 00:14:55.083 (should be expired)
[stage-7] Fetching key "apple" at 20:39:57.122 (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 nil: $-1\r\n
[stage-7] Received $-1\r\n
[stage-7] Received RESP null bulk string: "$-1\r\n"
[stage-7] Received "$-1\r\n"
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully
Expand Down
38 changes: 19 additions & 19 deletions internal/test_helpers/fixtures/rdb-read-value-with-expiry/pass
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Debug = true

[stage-13] Running tests for Stage #13: sm4
[stage-13] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles235325156 --dbfilename pear.rdb
[stage-13] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles388319618 --dbfilename pear.rdb
[stage-13] client: $ redis-cli GET orange
[stage-13] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$6\r\norange\r\n"
[stage-13] client: Received bytes: "$10\r\nstrawberry\r\n"
Expand All @@ -10,8 +10,8 @@ Debug = true
[stage-13] client: $ redis-cli GET mango
[stage-13] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$5\r\nmango\r\n"
[stage-13] client: Received bytes: "$-1\r\n"
[stage-13] client: Received RESP nil: $-1\r\n
[stage-13] Received $-1\r\n
[stage-13] client: Received RESP null bulk string: "$-1\r\n"
[stage-13] Received "$-1\r\n"
[stage-13] client: $ redis-cli GET pineapple
[stage-13] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$9\r\npineapple\r\n"
[stage-13] client: Received bytes: "$9\r\nblueberry\r\n"
Expand All @@ -23,7 +23,7 @@ Debug = true

[stage-12] Running tests for Stage #12: dq3
[stage-12] Created RDB file with key-value pairs: "grape"="pineapple", "apple"="raspberry", "banana"="apple", "mango"="orange", "orange"="pear"
[stage-12] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles577431708 --dbfilename raspberry.rdb
[stage-12] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles2171782643 --dbfilename raspberry.rdb
[stage-12] client: $ redis-cli GET grape
[stage-12] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$5\r\ngrape\r\n"
[stage-12] client: Received bytes: "$9\r\npineapple\r\n"
Expand Down Expand Up @@ -55,19 +55,19 @@ Debug = true

[stage-11] Running tests for Stage #11: jw4
[stage-11] Created RDB file with 3 keys: ["banana" "apple" "blueberry"]
[stage-11] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles230748225 --dbfilename blueberry.rdb
[stage-11] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1209284205 --dbfilename blueberry.rdb
[stage-11] client: $ redis-cli KEYS *
[stage-11] client: Sent bytes: "*2\r\n$4\r\nKEYS\r\n$1\r\n*\r\n"
[stage-11] client: Received bytes: "*3\r\n$5\r\napple\r\n$6\r\nbanana\r\n$9\r\nblueberry\r\n"
[stage-11] client: Received RESP array: ["apple", "banana", "blueberry"]
[stage-11] Received ["apple", "banana", "blueberry"]
[stage-11] client: Received bytes: "*3\r\n$5\r\napple\r\n$9\r\nblueberry\r\n$6\r\nbanana\r\n"
[stage-11] client: Received RESP array: ["apple", "blueberry", "banana"]
[stage-11] Received ["apple", "blueberry", "banana"]
[stage-11] Test passed.
[stage-11] Terminating program
[stage-11] Program terminated successfully

[stage-10] Running tests for Stage #10: gc6
[stage-10] Created RDB file with single key-value pair: grape="pineapple"
[stage-10] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles2095626595 --dbfilename orange.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles384942019 --dbfilename orange.rdb
[stage-10] client: $ redis-cli GET grape
[stage-10] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$5\r\ngrape\r\n"
[stage-10] client: Received bytes: "$9\r\npineapple\r\n"
Expand All @@ -79,7 +79,7 @@ Debug = true

[stage-9] Running tests for Stage #9: jz6
[stage-9] Created RDB file with single key: "mango"
[stage-9] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles58668727 --dbfilename pear.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles3198695930 --dbfilename pear.rdb
[stage-9] client: $ redis-cli KEYS *
[stage-9] client: Sent bytes: "*2\r\n$4\r\nKEYS\r\n$1\r\n*\r\n"
[stage-9] client: Received bytes: "*1\r\n$5\r\nmango\r\n"
Expand All @@ -90,12 +90,12 @@ Debug = true
[stage-9] Program terminated successfully

[stage-8] Running tests for Stage #8: zg5
[stage-8] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1682149838 --dbfilename blueberry.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles825729594 --dbfilename blueberry.rdb
[stage-8] client: $ redis-cli CONFIG GET dir
[stage-8] client: Sent bytes: "*3\r\n$6\r\nCONFIG\r\n$3\r\nGET\r\n$3\r\ndir\r\n"
[stage-8] client: Received bytes: "*2\r\n$3\r\ndir\r\n$75\r\n/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1682149838\r\n"
[stage-8] client: Received RESP array: ["dir", "/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1682149838"]
[stage-8] Received ["dir", "/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1682149838"]
[stage-8] client: Received bytes: "*2\r\n$3\r\ndir\r\n$74\r\n/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles825729594\r\n"
[stage-8] client: Received RESP array: ["dir", "/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles825729594"]
[stage-8] Received ["dir", "/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles825729594"]
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Program terminated successfully
Expand All @@ -107,20 +107,20 @@ Debug = true
[stage-7] Received bytes: "+OK\r\n"
[stage-7] Received RESP simple string: "OK"
[stage-7] Received "OK"
[stage-7] Received OK at 00:14:57.717
[stage-7] Fetching key "strawberry" at 00:14:57.717 (should not be expired)
[stage-7] Received OK at 20:40:46.013
[stage-7] Fetching key "strawberry" at 20:40:46.013 (should not be expired)
[stage-7] $ redis-cli GET strawberry
[stage-7] Sent bytes: "*2\r\n$3\r\nGET\r\n$10\r\nstrawberry\r\n"
[stage-7] Received bytes: "$4\r\npear\r\n"
[stage-7] Received RESP bulk string: "pear"
[stage-7] Received "pear"
[stage-7] Sleeping for 101ms
[stage-7] Fetching key "strawberry" at 00:14:57.820 (should be expired)
[stage-7] Fetching key "strawberry" at 20:40:46.116 (should be expired)
[stage-7] $ redis-cli GET strawberry
[stage-7] Sent bytes: "*2\r\n$3\r\nGET\r\n$10\r\nstrawberry\r\n"
[stage-7] Received bytes: "$-1\r\n"
[stage-7] Received RESP nil: $-1\r\n
[stage-7] Received $-1\r\n
[stage-7] Received RESP null bulk string: "$-1\r\n"
[stage-7] Received "$-1\r\n"
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully
Expand Down
Loading

0 comments on commit 9fcfee8

Please sign in to comment.