Skip to content

Commit

Permalink
Merge pull request #54 from codecrafters-io/redis-repl
Browse files Browse the repository at this point in the history
Fix issues with Redis Replication extension tests.
  • Loading branch information
rohitpaulk authored Feb 10, 2024
2 parents 0688f12 + 78c72e7 commit 050079e
Show file tree
Hide file tree
Showing 41 changed files with 869 additions and 880 deletions.
6 changes: 3 additions & 3 deletions internal/test_helpers/fixtures/expiry/pass
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:19:26.152)
[stage-7] $ redis-cli get grapes (sent at 16:19:26.152, key should not be expired)
[stage-7] Received OK (at 10:51:24.791)
[stage-7] $ redis-cli get grapes (sent at 10:51:24.791, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:19:26.253, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:51:24.893, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully
2 changes: 1 addition & 1 deletion internal/test_helpers/fixtures/ping-pong/eof
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Debug = true
[stage-2] $ redis-cli ping
[stage-2] Reading response...
[stage-2] Hint: 'connection reset by peer' usually means that your program closed the connection before sending a complete response.
[stage-2] read tcp 127.0.0.1:44712->127.0.0.1:6379: read: connection reset by peer
[stage-2] read tcp 127.0.0.1:36926->127.0.0.1:6379: read: connection reset by peer
[stage-2] Test failed
[stage-2] Terminating program
[stage-2] Program terminated successfully
8 changes: 4 additions & 4 deletions internal/test_helpers/fixtures/rdb-config/pass
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:18:18.077)
[stage-7] $ redis-cli get grapes (sent at 16:18:18.077, key should not be expired)
[stage-7] Received OK (at 10:45:55.221)
[stage-7] $ redis-cli get grapes (sent at 10:45:55.221, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:18:18.178, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:45:55.322, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2821543951 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2453435298 --dbfilename banana.rdb
[stage-8] $ redis-cli CONFIG GET dir
[stage-8] Test passed.
[stage-8] Terminating program
Expand Down
10 changes: 5 additions & 5 deletions internal/test_helpers/fixtures/rdb-read-key/pass
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,25 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:13:03.808)
[stage-7] $ redis-cli get grapes (sent at 16:13:03.808, key should not be expired)
[stage-7] Received OK (at 10:46:00.269)
[stage-7] $ redis-cli get grapes (sent at 10:46:00.269, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:13:03.909, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:46:00.370, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles1812715900 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2663685552 --dbfilename banana.rdb
[stage-8] $ redis-cli CONFIG GET dir
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-9] Running tests for Stage #9: rdb-read-key
[stage-9] Created RDB file with single key: "pear"
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles932854361 --dbfilename blueberry.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2112653960 --dbfilename blueberry.rdb
[stage-9] $ redis-cli KEYS *
[stage-9] Test passed.
[stage-9] Terminating program
Expand Down
14 changes: 7 additions & 7 deletions internal/test_helpers/fixtures/rdb-read-multiple-keys/pass
Original file line number Diff line number Diff line change
Expand Up @@ -69,41 +69,41 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:13:10.965)
[stage-7] $ redis-cli get grapes (sent at 16:13:10.965, key should not be expired)
[stage-7] Received OK (at 10:48:17.472)
[stage-7] $ redis-cli get grapes (sent at 10:48:17.472, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:13:11.066, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:48:17.573, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3943306056 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles4213548725 --dbfilename banana.rdb
[stage-8] $ redis-cli CONFIG GET dir
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-9] Running tests for Stage #9: rdb-read-key
[stage-9] Created RDB file with single key: "pear"
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2955232870 --dbfilename blueberry.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2764557421 --dbfilename blueberry.rdb
[stage-9] $ redis-cli KEYS *
[stage-9] Test passed.
[stage-9] Terminating program
[stage-9] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-10] Running tests for Stage #10: rdb-read-string-value
[stage-10] Created RDB file with single key-value pair: strawberry="apple"
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles857209564 --dbfilename banana.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles357388602 --dbfilename banana.rdb
[stage-10] $ redis-cli GET strawberry
[stage-10] Test passed.
[stage-10] Terminating program
[stage-10] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-11] Running tests for Stage #11: rdb-read-multiple-keys
[stage-11] Created RDB file with 5 keys: ["orange" "blueberry" "strawberry" "pineapple" "banana"]
[stage-11] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2475212012 --dbfilename pear.rdb
[stage-11] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles604186444 --dbfilename pear.rdb
[stage-11] $ redis-cli KEYS *
[stage-11] Test passed.
[stage-11] Terminating program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,49 +69,49 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:14:56.499)
[stage-7] $ redis-cli get grapes (sent at 16:14:56.499, key should not be expired)
[stage-7] Received OK (at 10:51:27.722)
[stage-7] $ redis-cli get grapes (sent at 10:51:27.722, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:14:56.600, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:51:27.823, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2249330888 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles4154756338 --dbfilename banana.rdb
[stage-8] $ redis-cli CONFIG GET dir
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-9] Running tests for Stage #9: rdb-read-key
[stage-9] Created RDB file with single key: "pear"
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles1442622124 --dbfilename blueberry.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2588948210 --dbfilename blueberry.rdb
[stage-9] $ redis-cli KEYS *
[stage-9] Test passed.
[stage-9] Terminating program
[stage-9] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-10] Running tests for Stage #10: rdb-read-string-value
[stage-10] Created RDB file with single key-value pair: strawberry="apple"
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2402876157 --dbfilename banana.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles1250161541 --dbfilename banana.rdb
[stage-10] $ redis-cli GET strawberry
[stage-10] Test passed.
[stage-10] Terminating program
[stage-10] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-11] Running tests for Stage #11: rdb-read-multiple-keys
[stage-11] Created RDB file with 5 keys: ["orange" "blueberry" "strawberry" "pineapple" "banana"]
[stage-11] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles69287226 --dbfilename pear.rdb
[stage-11] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2275471340 --dbfilename pear.rdb
[stage-11] $ redis-cli KEYS *
[stage-11] Test passed.
[stage-11] Terminating program
[stage-11] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-12] Running tests for Stage #12: rdb-read-multiple-string-values
[stage-12] Created RDB file with key-value pairs: "orange"="grape", "mango"="pear", "grape"="blueberry", "pear"="pineapple"
[stage-12] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3444005431 --dbfilename apple.rdb
[stage-12] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3718936964 --dbfilename apple.rdb
[stage-12] $ redis-cli GET orange
[stage-12] $ redis-cli GET mango
[stage-12] $ redis-cli GET grape
Expand Down
18 changes: 9 additions & 9 deletions internal/test_helpers/fixtures/rdb-read-value-with-expiry/pass
Original file line number Diff line number Diff line change
Expand Up @@ -69,49 +69,49 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:14:16.420)
[stage-7] $ redis-cli get grapes (sent at 16:14:16.420, key should not be expired)
[stage-7] Received OK (at 10:46:07.415)
[stage-7] $ redis-cli get grapes (sent at 10:46:07.415, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:14:16.521, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:46:07.516, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3208800161 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles1326260254 --dbfilename banana.rdb
[stage-8] $ redis-cli CONFIG GET dir
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-9] Running tests for Stage #9: rdb-read-key
[stage-9] Created RDB file with single key: "pear"
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3432958175 --dbfilename blueberry.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles1089935667 --dbfilename blueberry.rdb
[stage-9] $ redis-cli KEYS *
[stage-9] Test passed.
[stage-9] Terminating program
[stage-9] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-10] Running tests for Stage #10: rdb-read-string-value
[stage-10] Created RDB file with single key-value pair: strawberry="apple"
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles628259002 --dbfilename banana.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles184674477 --dbfilename banana.rdb
[stage-10] $ redis-cli GET strawberry
[stage-10] Test passed.
[stage-10] Terminating program
[stage-10] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-11] Running tests for Stage #11: rdb-read-multiple-keys
[stage-11] Created RDB file with 5 keys: ["orange" "blueberry" "strawberry" "pineapple" "banana"]
[stage-11] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2892838144 --dbfilename pear.rdb
[stage-11] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3073674735 --dbfilename pear.rdb
[stage-11] $ redis-cli KEYS *
[stage-11] Test passed.
[stage-11] Terminating program
[stage-11] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-12] Running tests for Stage #12: rdb-read-multiple-string-values
[stage-12] Created RDB file with key-value pairs: "orange"="grape", "mango"="pear", "grape"="blueberry", "pear"="pineapple"
[stage-12] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2112699836 --dbfilename apple.rdb
[stage-12] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2582547524 --dbfilename apple.rdb
[stage-12] $ redis-cli GET orange
[stage-12] $ redis-cli GET mango
[stage-12] $ redis-cli GET grape
Expand All @@ -121,7 +121,7 @@ Debug = true
[stage-12] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-13] Running tests for Stage #13: rdb-read-value-with-expiry
[stage-13] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3006381122 --dbfilename apple.rdb
[stage-13] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles356209747 --dbfilename apple.rdb
[stage-13] $ redis-cli GET pineapple
[stage-13] $ redis-cli GET raspberry
[stage-13] $ redis-cli GET blueberry
Expand Down
12 changes: 6 additions & 6 deletions internal/test_helpers/fixtures/rdb-string-value/pass
Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,33 @@ Debug = true
[stage-7] Running tests for Stage #7: expiry
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli set grapes apples px 100
[stage-7] Received OK (at 16:17:17.463)
[stage-7] $ redis-cli get grapes (sent at 16:17:17.463, key should not be expired)
[stage-7] Received OK (at 10:48:08.219)
[stage-7] $ redis-cli get grapes (sent at 10:48:08.219, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 16:17:17.564, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 10:48:08.320, key should be expired)
[stage-7] Test passed.
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3694162994 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles421878518 --dbfilename banana.rdb
[stage-8] $ redis-cli CONFIG GET dir
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-9] Running tests for Stage #9: rdb-read-key
[stage-9] Created RDB file with single key: "pear"
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles1612545614 --dbfilename blueberry.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3236821878 --dbfilename blueberry.rdb
[stage-9] $ redis-cli KEYS *
[stage-9] Test passed.
[stage-9] Terminating program
[stage-9] Error terminating program: 'program failed to exit in 2 seconds after receiving sigterm'

[stage-10] Running tests for Stage #10: rdb-read-string-value
[stage-10] Created RDB file with single key-value pair: strawberry="apple"
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles2054421396 --dbfilename banana.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /tmp/rdbfiles3243568350 --dbfilename banana.rdb
[stage-10] $ redis-cli GET strawberry
[stage-10] Test passed.
[stage-10] Terminating program
Expand Down
Loading

0 comments on commit 050079e

Please sign in to comment.