-
Notifications
You must be signed in to change notification settings - Fork 13
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-1299: Update RESP framework to accomodate Transaction tests elegantly #153
Commits on Jun 12, 2024
-
feat: Add ordered array assertion for RESP values
This commit adds a new `OrderedArrayAssertion` struct to the `resp_assertions` package. This assertion is used to compare the order of actual and expected values in an array. It checks that the length of the actual array matches the expected length, and then iterates through each element to compare their types and values. If any element does not match, an error is returned. The `OrderedArrayAssertion` is useful for cases where the order of elements in an array matters, such as when comparing the response of a Redis command.
Configuration menu - View commit details
-
Copy full SHA for 39df651 - Browse repository at this point
Copy the full SHA 39df651View commit details -
implement new transaction stages Added test functions, `testTxSuccess` and `testTxErr`, which use the `OrderedArrayAssertion` to test transaction success and error scenarios.
Configuration menu - View commit details
-
Copy full SHA for fa84532 - Browse repository at this point
Copy the full SHA fa84532View commit details -
Configuration menu - View commit details
-
Copy full SHA for 08ac41d - Browse repository at this point
Copy the full SHA 08ac41dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f7be75 - Browse repository at this point
Copy the full SHA 5f7be75View commit details -
feat: Add bytes field to Value struct for Ints and Nils
The `Value` struct in the `value.go` file has been updated to include a new `bytes` field. This field is used to store the byte representation of the value. The `NewNilValue` function has also been updated to set the `bytes` field to `[]byte("$-1\r\n")`.
Configuration menu - View commit details
-
Copy full SHA for af0e0d9 - Browse repository at this point
Copy the full SHA af0e0d9View commit details -
feat: Refactor testTxMulti function to use MultiCommandTestCase
The `testTxMulti` function in the `test_txn_11.go` file has been refactored to use the `MultiCommandTestCase` struct for executing multiple transactions. This change improves code readability and maintainability by encapsulating the commands and assertions within a single test case object.
Configuration menu - View commit details
-
Copy full SHA for 7087489 - Browse repository at this point
Copy the full SHA 7087489View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9e28d76 - Browse repository at this point
Copy the full SHA 9e28d76View commit details -
feat: refactor testTxDiscard function to use MultiCommandTestCase
The `testTxDiscard` function in the `test_txn_9.go` file has been refactored to use the `MultiCommandTestCase` struct for executing multiple commands within a transaction. This change improves code readability and maintainability by encapsulating the commands and assertions within a single test case object.
Configuration menu - View commit details
-
Copy full SHA for d82bbb6 - Browse repository at this point
Copy the full SHA d82bbb6View commit details -
Configuration menu - View commit details
-
Copy full SHA for cf7e938 - Browse repository at this point
Copy the full SHA cf7e938View commit details -
Configuration menu - View commit details
-
Copy full SHA for 67b14ec - Browse repository at this point
Copy the full SHA 67b14ecView commit details
Commits on Jun 13, 2024
-
feat: add tests for stages 1 - 3
Use MultiCommandTestCase for testTxIncr1, testTxIncr2, and testTxIncr3
Configuration menu - View commit details
-
Copy full SHA for fecf766 - Browse repository at this point
Copy the full SHA fecf766View commit details -
feat: Add testTxMulti function to internal package
This commit adds the testTxMulti function to the internal package. The function sets up a Redis executable and creates an instrumented RESP connection. It then runs a command test case using the MULTI command with no arguments, asserting that the response is "OK".
Configuration menu - View commit details
-
Copy full SHA for fb6e805 - Browse repository at this point
Copy the full SHA fb6e805View commit details -
feat: Add testTxEmpty function to internal package
This commit adds the testTxEmpty function to the internal package. The function tests an empty transaction by running a Redis executable and executing various test cases. It includes assertions for error handling and ensures that the EXEC command without MULTI returns an error.
Configuration menu - View commit details
-
Copy full SHA for 11c4a5c - Browse repository at this point
Copy the full SHA 11c4a5cView commit details -
feat: Add testTxQueue function for testing transaction queue
This commit adds the `testTxQueue` function to the internal package. The function sets up a Redis executable and creates two instrumented RESP connections. It then runs a transaction test case, followed by a command test case. This new function will be used for testing the transaction queue functionality.
Configuration menu - View commit details
-
Copy full SHA for 2c4393a - Browse repository at this point
Copy the full SHA 2c4393aView commit details -
This commit adds the `testTxExec` function to the internal package. The function sets up a Redis executable, creates an instrumented RESP connection, and runs a test case for the `EXEC` command.
Configuration menu - View commit details
-
Copy full SHA for 2003c23 - Browse repository at this point
Copy the full SHA 2003c23View commit details -
Configuration menu - View commit details
-
Copy full SHA for c1e381f - Browse repository at this point
Copy the full SHA c1e381fView commit details -
feat: Add multiple clients to testTxErr, testTxSuccess, and testTxDis…
…card - Added support for multiple clients in the functions `testTxErr`, `testTxSuccess`, and `testTxDiscard`. - Each client is created with a unique name using the format "client-{index+1}". - The clients are stored in an array for later use. - The clients are closed using the `Close` method before returning from the function.
Configuration menu - View commit details
-
Copy full SHA for a5de8c0 - Browse repository at this point
Copy the full SHA a5de8c0View commit details -
feat: Add
spawnClients
functionThis commit adds the `spawnClients` function. The `spawnClients` function is responsible for creating a specified number of client connections to a given address. It takes in the number of clients, address, stage harness, and logger as parameters. The function creates the clients and appends them to a slice before returning it. This new function is used in multiple places throughout the codebase to create client connections.
Configuration menu - View commit details
-
Copy full SHA for 983add3 - Browse repository at this point
Copy the full SHA 983add3View commit details -
feat: Update function name and add documentation for spawning clients
- Renamed the `spawnClients` function to `SpawnClients` - Added documentation for the `SpawnClients` function, explaining its purpose and usage - The `SpawnClients` function creates multiple clients connected to a given address using the `instrumented_resp_connection.NewFromAddr` function - Clients are expected to be closed after use
Configuration menu - View commit details
-
Copy full SHA for 035058f - Browse repository at this point
Copy the full SHA 035058fView commit details -
feat: update tester_definition with new test cases for transactions
This commit adds new test cases for transaction functionality. The added test cases cover various stages of transactions, including INCR, MULTI, EXEC, and more. These tests ensure that the transaction functionality is working as expected. - Added new test cases for transaction functionality - Covered stages such as INCR-1, INCR-2, INCR-3, MULTI, EXEC, Empty Transaction, Queueing Commands - Ensured proper execution and handling of failed transactions
Configuration menu - View commit details
-
Copy full SHA for b0e7962 - Browse repository at this point
Copy the full SHA b0e7962View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0bd8bac - Browse repository at this point
Copy the full SHA 0bd8bacView commit details -
refactor: Rename test stages from numbered stages to named stages
This commit renames several files in the internal directory for better clarity and organization. The changes include renaming `test_txn_9.go` to `test_txn_discard.go`, `test_txn_11.go` to `test_txn_multi_tx.go`, `test_txn_8.go` to `test_txn_tx.go`, and `test_txn_10.go` to `test_txn_tx_failure.go`. These file name updates improve the readability and maintainability of the codebase.
Configuration menu - View commit details
-
Copy full SHA for 28be476 - Browse repository at this point
Copy the full SHA 28be476View commit details -
refactor: improve transaction test cases
- Skip execution of transaction commands - Use `RunAll` instead of `RunMulti` and `RunQueueAll` - Update result array for each transaction command
Configuration menu - View commit details
-
Copy full SHA for a3957c1 - Browse repository at this point
Copy the full SHA a3957c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for f2c6762 - Browse repository at this point
Copy the full SHA f2c6762View commit details -
feat: Add support for Transactions extension
This commit adds the "Transactions" extension to the Redis implementation. It includes the implementation of commands such as MULTI, EXEC, DISCARD, and handling failures within transactions. The extension also introduces stages for implementing the INCR command in multiple steps.
Configuration menu - View commit details
-
Copy full SHA for a764c12 - Browse repository at this point
Copy the full SHA a764c12View commit details
Commits on Jun 14, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 7b04ff9 - Browse repository at this point
Copy the full SHA 7b04ff9View commit details -
feat: Refactor transaction test cases
- Removed the ShouldSkipExec flag from the TransactionTestCase struct - Renamed the RunAll method to RunWithoutExec in the TransactionTestCase struct - Updated test_txn_discard.go, test_txn_multi.go, test_txn_multi_tx.go, and test_txn_queue.go to use the RunWithoutExec method instead of RunAll
Configuration menu - View commit details
-
Copy full SHA for 715817c - Browse repository at this point
Copy the full SHA 715817cView commit details -
feat: add randomness to test case for transaction failure
This commit adds a new test case to the `testTxErr` function in `internal/test_txn_tx_failure.go`. The test case includes commands to set random values for two keys, and then increment those values within a transaction. The expected result is an error value indicating that the value is not an integer or out of range, followed by the incremented value. After running the transaction, there are assertions to check if the values were updated correctly. The purpose of this change is to ensure that transactions handle errors properly and provide accurate results when dealing with non-integer values.
Configuration menu - View commit details
-
Copy full SHA for 571cdf7 - Browse repository at this point
Copy the full SHA 571cdf7View commit details -
feat: add randomness to test case for transaction success
This commit adds a new transaction test case to the `testTxSuccess` function in `internal/test_txn_tx.go`. The test case includes commands for setting random keys with random integer values, incrementing the values, and retrieving them. The expected results are updated accordingly. Additionally, a command test case is added to verify the final value of one of the keys.
Configuration menu - View commit details
-
Copy full SHA for a37aa7b - Browse repository at this point
Copy the full SHA a37aa7bView commit details -
feat: add random key generation for INCR test cases
This commit adds the functionality to generate random keys for test cases in `test_txn_incr1.go`, `test_txn_incr2.go`, and `test_txn_incr3.go`. The generated keys are used in the `SET` and `INCR` commands. This change improves the flexibility and randomness of the test cases.
Configuration menu - View commit details
-
Copy full SHA for af87ab5 - Browse repository at this point
Copy the full SHA af87ab5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4bf9120 - Browse repository at this point
Copy the full SHA 4bf9120View commit details -
feat: Add randomness to test cases for transaction discard
This commit adds new test cases to the `testTxDiscard` function in `internal/test_txn_discard.go`. The changes include: - Importing the `fmt` package - Generating unique keys using the `random.RandomWords` function - Generating random integers using the `random.RandomInt` function - Modifying the command arguments to use the generated keys and random integers - Updating assertions to use the generated values These changes enhance the test coverage for transaction discards.
Configuration menu - View commit details
-
Copy full SHA for 63b9b01 - Browse repository at this point
Copy the full SHA 63b9b01View commit details -
feat: add randomness to concurrent txn test
- In test_txn_discard, changed the number of uniqueKeys generated from 3 to 2. - In test_txn_multi_tx, updated the commands to set key2 with a random integer value and increment key1. - Also added a comment explaining the expected result in each transaction. - In test_txn_queue, updated the command to set a random key with a random integer value and increment it.
Configuration menu - View commit details
-
Copy full SHA for 263a9cb - Browse repository at this point
Copy the full SHA 263a9cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3f032d4 - Browse repository at this point
Copy the full SHA 3f032d4View commit details -
Merge pull request #154 from codecrafters-io/CC-1299-txn-stages
CC-1299: Implement Transactions extension tests
Configuration menu - View commit details
-
Copy full SHA for 6690867 - Browse repository at this point
Copy the full SHA 6690867View commit details -
fix: update naming to match standards, update internal error codes
- Refactor MultiCommandTestCase error message - Update TransactionTestCase comment and variable names - Modify logger debug message in RunQueueAll function - Rename ResultArray to ExpectedResponseArray
Configuration menu - View commit details
-
Copy full SHA for 634dcce - Browse repository at this point
Copy the full SHA 634dcceView commit details -
refactor: refactor transaction test case to accept an array of assert…
…ions Update tests accordingly
Configuration menu - View commit details
-
Copy full SHA for 77a2189 - Browse repository at this point
Copy the full SHA 77a2189View commit details -
Configuration menu - View commit details
-
Copy full SHA for a3b7777 - Browse repository at this point
Copy the full SHA a3b7777View commit details -
fix: use quoted values in error assertion failure logs
Co-authored-by: Paul Kuruvilla <rohitpaulk@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for b665420 - Browse repository at this point
Copy the full SHA b665420View commit details -
Configuration menu - View commit details
-
Copy full SHA for f89d1ff - Browse repository at this point
Copy the full SHA f89d1ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for b1bebb4 - Browse repository at this point
Copy the full SHA b1bebb4View commit details