Skip to content

Commit

Permalink
feat: Update function name and add documentation for spawning clients
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ryan-gang committed Jun 13, 2024
1 parent 983add3 commit 035058f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/test_txn_10.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func testTxErr(stageHarness *test_case_harness.TestCaseHarness) error {

logger := stageHarness.Logger

clients, err := spawnClients(2, "localhost:6379", stageHarness, logger)
clients, err := SpawnClients(2, "localhost:6379", stageHarness, logger)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/test_txn_11.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func testTxMultiTx(stageHarness *test_case_harness.TestCaseHarness) error {

logger := stageHarness.Logger

clients, err := spawnClients(3, "localhost:6379", stageHarness, logger)
clients, err := SpawnClients(3, "localhost:6379", stageHarness, logger)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/test_txn_8.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func testTxSuccess(stageHarness *test_case_harness.TestCaseHarness) error {

logger := stageHarness.Logger

clients, err := spawnClients(2, "localhost:6379", stageHarness, logger)
clients, err := SpawnClients(2, "localhost:6379", stageHarness, logger)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/test_txn_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func testTxQueue(stageHarness *test_case_harness.TestCaseHarness) error {

logger := stageHarness.Logger

clients, err := spawnClients(2, "localhost:6379", stageHarness, logger)
clients, err := SpawnClients(2, "localhost:6379", stageHarness, logger)
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion internal/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ func SpawnReplicas(replicaCount int, stageHarness *test_case_harness.TestCaseHar
return replicas, nil
}

func spawnClients(clientCount int, addr string, stageHarness *test_case_harness.TestCaseHarness, logger *logger.Logger) ([]*resp_connection.RespConnection, error) {
// SpawnClients creates `clientCount` clients connected to the given address.
// The clients are created using the `instrumented_resp_connection.NewFromAddr` function.
// Clients are supposed to be closed after use.
func SpawnClients(clientCount int, addr string, stageHarness *test_case_harness.TestCaseHarness, logger *logger.Logger) ([]*resp_connection.RespConnection, error) {
var clients []*resp_connection.RespConnection

for i := 0; i < clientCount; i++ {
Expand Down

0 comments on commit 035058f

Please sign in to comment.