Skip to content

Commit

Permalink
feat: Update test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
libmartinito committed May 16, 2024
1 parent d466410 commit e8b02a4
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 324 deletions.
132 changes: 88 additions & 44 deletions internal/test_helpers/course_definition.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/test_helpers/fixtures/bind/failure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[stage-1] Running tests for Stage #1: init
[stage-1] Running tests for Stage #1: jm1
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[your_program] hey, not going to bind!
Expand Down
2 changes: 1 addition & 1 deletion internal/test_helpers/fixtures/bind/success
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Debug = true

[stage-1] Running tests for Stage #1: init
[stage-1] Running tests for Stage #1: jm1
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[your_program] hey, binding to 6379
Expand Down
2 changes: 1 addition & 1 deletion internal/test_helpers/fixtures/bind/timeout
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[stage-1] Running tests for Stage #1: init
[stage-1] Running tests for Stage #1: jm1
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[your_program] hey, not going to bind!
Expand Down
20 changes: 10 additions & 10 deletions internal/test_helpers/fixtures/expiry/pass
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Debug = true

[stage-7] Running tests for Stage #7: expiry
[stage-7] Running tests for Stage #7: yz1
[stage-7] $ ./spawn_redis_server.sh
[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 "OK"
[stage-7] Received OK at 17:00:21.700
[stage-7] Fetching key "apple" at 17:00:21.700 (should not be expired)
[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] $ 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 "blueberry"
[stage-7] Sleeping for 101ms
[stage-7] Fetching key "apple" at 17:00:21.803 (should be expired)
[stage-7] Fetching key "apple" at 02:05:03.316 (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"
Expand All @@ -25,7 +25,7 @@ Debug = true
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-6] Running tests for Stage #6: set_get
[stage-6] Running tests for Stage #6: la7
[stage-6] $ ./spawn_redis_server.sh
[stage-6] Setting key blueberry to raspberry
[stage-6] $ redis-cli SET blueberry raspberry
Expand All @@ -43,7 +43,7 @@ Debug = true
[stage-6] Terminating program
[stage-6] Program terminated successfully

[stage-5] Running tests for Stage #5: echo
[stage-5] Running tests for Stage #5: qq0
[stage-5] $ ./spawn_redis_server.sh
[stage-5] $ redis-cli ECHO pear
[stage-5] Sent bytes: "*2\r\n$4\r\nECHO\r\n$4\r\npear\r\n"
Expand All @@ -54,7 +54,7 @@ Debug = true
[stage-5] Terminating program
[stage-5] Program terminated successfully

[stage-4] Running tests for Stage #4: concurrent-clients
[stage-4] Running tests for Stage #4: zu2
[stage-4] $ ./spawn_redis_server.sh
[stage-4] client-1: $ redis-cli PING
[stage-4] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
Expand Down Expand Up @@ -93,7 +93,7 @@ Debug = true
[stage-4] Terminating program
[stage-4] Program terminated successfully

[stage-3] Running tests for Stage #3: ping-pong-multiple
[stage-3] Running tests for Stage #3: wy1
[stage-3] $ ./spawn_redis_server.sh
[stage-3] client-1: $ redis-cli PING
[stage-3] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
Expand All @@ -115,7 +115,7 @@ Debug = true
[stage-3] Terminating program
[stage-3] Program terminated successfully

[stage-2] Running tests for Stage #2: ping-pong
[stage-2] Running tests for Stage #2: rg2
[stage-2] $ ./spawn_redis_server.sh
[stage-2] Connection established, sending ping command...
[stage-2] $ redis-cli PING
Expand All @@ -127,7 +127,7 @@ Debug = true
[stage-2] Terminating program
[stage-2] Program terminated successfully

[stage-1] Running tests for Stage #1: init
[stage-1] Running tests for Stage #1: jm1
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[stage-1] Connection successful
Expand Down
2 changes: 1 addition & 1 deletion internal/test_helpers/fixtures/ping-pong/eof
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Debug = true

[stage-2] Running tests for Stage #2: ping-pong
[stage-2] Running tests for Stage #2: rg2
[stage-2] $ ./spawn_redis_server.sh
[your_program] hey, binding to 6379
[stage-2] Connection established, sending ping command...
Expand Down
4 changes: 2 additions & 2 deletions internal/test_helpers/fixtures/ping-pong/slow_response
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[stage-2] Running tests for Stage #2: ping-pong
[stage-2] Running tests for Stage #2: rg2
[stage-2] $ ./spawn_redis_server.sh
[your_program] hey, binding to 6379
[stage-2] $ redis-cli PING
[stage-2] Received "PONG"
[stage-2] Test passed.

[stage-1] Running tests for Stage #1: init
[stage-1] Running tests for Stage #1: jm1
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[your_program] hey, binding to 6379
Expand Down
2 changes: 1 addition & 1 deletion internal/test_helpers/fixtures/ping-pong/without_crlf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[stage-2] Running tests for Stage #2: ping-pong
[stage-2] Running tests for Stage #2: rg2
[stage-2] $ ./spawn_redis_server.sh
[your_program] hey, binding to 6379
[stage-2] $ redis-cli PING
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[stage-2] Running tests for Stage #2: ping-pong
[stage-2] Running tests for Stage #2: rg2
[stage-2] $ ./spawn_redis_server.sh
[your_program] Logs from your program will appear here!
[stage-2] $ redis-cli PING
Expand Down
56 changes: 28 additions & 28 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: rdb-read-value-with-expiry
[stage-13] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles3027591544 --dbfilename pear.rdb
[stage-13] Running tests for Stage #13: sm4
[stage-13] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles930858323 --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 @@ -21,9 +21,9 @@ Debug = true
[stage-13] Terminating program
[stage-13] Program terminated successfully

[stage-12] Running tests for Stage #12: rdb-read-multiple-string-values
[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/rdbfiles4230549431 --dbfilename raspberry.rdb
[stage-12] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles291464650 --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 @@ -53,21 +53,21 @@ Debug = true
[stage-12] Terminating program
[stage-12] Program terminated successfully

[stage-11] Running tests for Stage #11: rdb-read-multiple-keys
[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/rdbfiles1567495839 --dbfilename blueberry.rdb
[stage-11] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3424348494 --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 value: ["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 value: ["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: rdb-read-string-value
[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/rdbfiles775229267 --dbfilename orange.rdb
[stage-10] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles1667355668 --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 @@ -77,9 +77,9 @@ Debug = true
[stage-10] Terminating program
[stage-10] Program terminated successfully

[stage-9] Running tests for Stage #9: rdb-read-key
[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/rdbfiles1527972385 --dbfilename pear.rdb
[stage-9] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles4106213172 --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 @@ -89,33 +89,33 @@ Debug = true
[stage-9] Terminating program
[stage-9] Program terminated successfully

[stage-8] Running tests for Stage #8: rdb-config
[stage-8] $ ./spawn_redis_server.sh --dir /private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1821958071 --dbfilename blueberry.rdb
[stage-8] Running tests for Stage #8: zg5
[stage-8] $ ./spawn_redis_server.sh --dir /private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3669335023 --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/rdbfiles1821958071\r\n"
[stage-8] client: Received RESP value: ["dir", "/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1821958071"]
[stage-8] Received ["dir", "/private/var/folders/5l/z5y3dkwn68sgb6htzc5w7vnm0000gn/T/rdbfiles1821958071"]
[stage-8] client: Received bytes: "*2\r\n$3\r\ndir\r\n$75\r\n/private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3669335023\r\n"
[stage-8] client: Received RESP value: ["dir", "/private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3669335023"]
[stage-8] Received ["dir", "/private/var/folders/79/lp3v5_c16v979pz111l0v__m0000gn/T/rdbfiles3669335023"]
[stage-8] Test passed.
[stage-8] Terminating program
[stage-8] Program terminated successfully

[stage-7] Running tests for Stage #7: expiry
[stage-7] Running tests for Stage #7: yz1
[stage-7] $ ./spawn_redis_server.sh
[stage-7] $ redis-cli SET strawberry pear px 100
[stage-7] Sent bytes: "*5\r\n$3\r\nSET\r\n$10\r\nstrawberry\r\n$4\r\npear\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 "OK"
[stage-7] Received OK at 21:36:24.124
[stage-7] Fetching key "strawberry" at 21:36:24.124 (should not be expired)
[stage-7] Received OK at 02:05:11.019
[stage-7] Fetching key "strawberry" at 02:05:11.019 (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 value: "pear"
[stage-7] Received "pear"
[stage-7] Sleeping for 101ms
[stage-7] Fetching key "strawberry" at 21:36:24.227 (should be expired)
[stage-7] Fetching key "strawberry" at 02:05:11.122 (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"
Expand All @@ -125,7 +125,7 @@ Debug = true
[stage-7] Terminating program
[stage-7] Program terminated successfully

[stage-6] Running tests for Stage #6: set_get
[stage-6] Running tests for Stage #6: la7
[stage-6] $ ./spawn_redis_server.sh
[stage-6] Setting key grape to raspberry
[stage-6] $ redis-cli SET grape raspberry
Expand All @@ -143,7 +143,7 @@ Debug = true
[stage-6] Terminating program
[stage-6] Program terminated successfully

[stage-5] Running tests for Stage #5: echo
[stage-5] Running tests for Stage #5: qq0
[stage-5] $ ./spawn_redis_server.sh
[stage-5] $ redis-cli ECHO mango
[stage-5] Sent bytes: "*2\r\n$4\r\nECHO\r\n$5\r\nmango\r\n"
Expand All @@ -154,7 +154,7 @@ Debug = true
[stage-5] Terminating program
[stage-5] Program terminated successfully

[stage-4] Running tests for Stage #4: concurrent-clients
[stage-4] Running tests for Stage #4: zu2
[stage-4] $ ./spawn_redis_server.sh
[stage-4] client-1: $ redis-cli PING
[stage-4] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
Expand Down Expand Up @@ -193,7 +193,7 @@ Debug = true
[stage-4] Terminating program
[stage-4] Program terminated successfully

[stage-3] Running tests for Stage #3: ping-pong-multiple
[stage-3] Running tests for Stage #3: wy1
[stage-3] $ ./spawn_redis_server.sh
[stage-3] client-1: $ redis-cli PING
[stage-3] client-1: Sent bytes: "*1\r\n$4\r\nPING\r\n"
Expand All @@ -215,7 +215,7 @@ Debug = true
[stage-3] Terminating program
[stage-3] Program terminated successfully

[stage-2] Running tests for Stage #2: ping-pong
[stage-2] Running tests for Stage #2: rg2
[stage-2] $ ./spawn_redis_server.sh
[stage-2] Connection established, sending ping command...
[stage-2] $ redis-cli PING
Expand All @@ -227,7 +227,7 @@ Debug = true
[stage-2] Terminating program
[stage-2] Program terminated successfully

[stage-1] Running tests for Stage #1: init
[stage-1] Running tests for Stage #1: jm1
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[stage-1] Connection successful
Expand Down
Loading

0 comments on commit e8b02a4

Please sign in to comment.