Skip to content

Commit

Permalink
Merge pull request #81 from codecrafters-io/CC-986-improvements-first…
Browse files Browse the repository at this point in the history
…-round

CC-986 first round of improvements
  • Loading branch information
libmartinito authored Feb 29, 2024
2 parents 76f3dae + bef46f2 commit 6ff3836
Show file tree
Hide file tree
Showing 15 changed files with 687 additions and 373 deletions.
664 changes: 421 additions & 243 deletions internal/test_helpers/course_definition.yml

Large diffs are not rendered by default.

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 21:51:33.704)
[stage-7] $ redis-cli get grapes (sent at 21:51:33.704, key should not be expired)
[stage-7] Received OK (at 19:49:48.327)
[stage-7] $ redis-cli get grapes (sent at 19:49:48.328, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 21:51:33.807, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 19:49:48.430, 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:52144->127.0.0.1:6379: read: connection reset by peer
[stage-2] read tcp 127.0.0.1:56061->127.0.0.1:6379: read: connection reset by peer
[stage-2] Test failed
[stage-2] Terminating program
[stage-2] Program terminated successfully
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 21:52:51.696)
[stage-7] $ redis-cli get grapes (sent at 21:52:51.696, key should not be expired)
[stage-7] Received OK (at 19:49:51.314)
[stage-7] $ redis-cli get grapes (sent at 19:49:51.314, key should not be expired)
[stage-7] Received "apples"
[stage-7] Sleeping for 101ms
[stage-7] $ redis-cli get grapes (sent at 21:52:51.798, key should be expired)
[stage-7] $ redis-cli get grapes (sent at 19:49:51.417, 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 /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3486794286 --dbfilename banana.rdb
[stage-8] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles747357432 --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 /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles2890289385 --dbfilename blueberry.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3951800291 --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 /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles2759990213 --dbfilename banana.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles181087419 --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 /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles279585842 --dbfilename pear.rdb
[stage-11] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles2806747938 --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 /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles2789076272 --dbfilename apple.rdb
[stage-12] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles4281641602 --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 /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles2269444035 --dbfilename apple.rdb
[stage-13] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles585942647 --dbfilename apple.rdb
[stage-13] $ redis-cli GET pineapple
[stage-13] $ redis-cli GET raspberry
[stage-13] $ redis-cli GET blueberry
Expand Down
Loading

0 comments on commit 6ff3836

Please sign in to comment.