Skip to content
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

Vtgateproxy E2E tests #364

Merged
merged 5 commits into from
May 31, 2024
Merged

Vtgateproxy E2E tests #364

merged 5 commits into from
May 31, 2024

Conversation

rjlaine
Copy link
Collaborator

@rjlaine rjlaine commented May 22, 2024

Description

Add end to end tests for vtgateproxy.

Scenarios Tested

  • A single vtgate and vtgateproxy process, in both round_robin and first_ready mode, testing 1 unsharded write and read
  • A test of a single vtgate failure in a pool of connections in round_robin mode
  • A test of an active vtgate failure in first_ready mode
  • A test of cluster rebalancing as vtgates are added, in both round_robin and first_ready mode
    • This test is currently flappy for both modes until we nail down desired behavior
  • A test of scaling a cluster of vtgates up from 0 to NumConnections+1, and then back to 0, in both round_robin and first_ready mode
    • In first_ready mode, we expect queries to fail immediately instead of timing out when there are 0 vtgates in the target pool

Running tests

You can run the tests locally as follows:

  1. Follow workstation setup here
  2. . dev.env
  3. make tools
  4. make build
  5. go test -v ./go/test/endtoend/vtgateproxytest/ -run=TestVtgateProxyVtgateFailureFirstReady --logtostderr=1

Outstanding changes

When we're ready to run tests in CI/CD, we'll want to add their configuration to ./test/config.json

Other changes

Several references to global variables were replaced with local type attributes to facilitate testing.

Cases where errors were silently swallowed and not returned were fixed, so that errors are returned or logged in all cases.

Linter errors were also addressed.

The go mysql driver was updated to a newer version which supports connection attributes for pool routing in the default mysql driver client.

@rjlaine rjlaine marked this pull request as draft May 22, 2024 01:26
@rjlaine rjlaine force-pushed the vtgateproxy-e2e-test branch from 1e60723 to 32faf12 Compare May 22, 2024 01:41
@rjlaine rjlaine force-pushed the vtgateproxy-e2e-test branch from 32faf12 to 0ea874f Compare May 22, 2024 18:29
@rjlaine rjlaine marked this pull request as ready for review May 22, 2024 18:46
@@ -317,7 +330,7 @@ func (b *JSONGateResolverBuilder) GetPools() []string {
return pools
}

func (b *JSONGateResolverBuilder) GetTargets(poolType string) []targetHost {
func (b *JSONGateResolverBuilder) getTargets(poolType string) []targetHost {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made private because its return type is private

@rjlaine rjlaine merged commit d951c5e into vtgateproxy May 31, 2024
152 of 241 checks passed
@rjlaine rjlaine deleted the vtgateproxy-e2e-test branch May 31, 2024 14:52
dedelala pushed a commit that referenced this pull request Jul 30, 2024
* Add end to end tests for vtgateproxy

* Fix linter warnings and unhandled errors

---------

Signed-off-by: Riley Laine <[email protected]>
Signed-off-by: Esme Lamb <[email protected]>
dedelala pushed a commit that referenced this pull request Nov 12, 2024
* Add end to end tests for vtgateproxy

* Fix linter warnings and unhandled errors

---------

Signed-off-by: Riley Laine <[email protected]>
Signed-off-by: Esme Lamb <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants