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

fix: Various issues found in testing Ruby client #166

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

meagar
Copy link
Contributor

@meagar meagar commented Apr 15, 2024

Introduce a few small fixes to allow the test suite to run against the Ruby test proxy. Several tests were failing either because they waited on a channel that would not receive anything, or they attempted to read through a nil pointer.

The corresponding test proxy is here: googleapis/google-cloud-ruby#25680

Copy link

conventional-commit-lint-gcf bot commented Apr 15, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@meagar meagar force-pushed the ruby-client-tests branch 4 times, most recently from 5339787 to 7e8f50e Compare April 16, 2024 14:23
@@ -336,17 +336,18 @@ func TestMutateRows_Retry_ExponentialBackoff(t *testing.T) {

// 4b. Log the retry delays
origReq := <-recorder
firstRetry := <-recorder
secondRetry := <-recorder
thirdRetry := <-recorder
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code was hanging indefinitely when the client made fewer than three retries.

@meagar meagar force-pushed the ruby-client-tests branch from 7e8f50e to 102cd3d Compare April 16, 2024 14:25
assert.Nil(t, err, "failed to decode client feature flags")

assert.True(t, ff.ReverseScans, "client does must enable ReverseScans feature flag")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was segfaulting when ff was nil.

@meagar meagar force-pushed the ruby-client-tests branch from 102cd3d to aeafea1 Compare April 16, 2024 14:28
@meagar meagar force-pushed the ruby-client-tests branch from aeafea1 to 78ac1f3 Compare April 16, 2024 14:30
@meagar meagar force-pushed the ruby-client-tests branch from 78ac1f3 to d3e231b Compare April 16, 2024 14:31
@meagar meagar changed the title Fixes for Ruby Client tests fix: Various issues found in testing Ruby client Apr 16, 2024
@meagar meagar marked this pull request as ready for review April 16, 2024 14:32
tests/mutaterows_test.go Show resolved Hide resolved
// Different clients may have different behaviors, we log the delays for informational purpose.
// Example: For the first retry delay, C++ client uses 100ms but Java client uses 10ms.
t.Logf("The three retry delays are: %dms, %dms, %dms", firstDelay, secondDelay, thirdDelay)
for n := 1; n < numRPCs; n += 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe in the end we should assert that n == 3? so it doesn't hang and we can verify the client retried 3 times?

Copy link
Contributor Author

@meagar meagar Apr 16, 2024

Choose a reason for hiding this comment

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

There's an assertion for this above,

	// 4a. Check the number of requests in the recorder
	assert.Equal(t, numRPCs, len(recorder))

This lines are not functionally part of the test, they just seem to output debugging information. There are no assertions here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

true :) ok

tests/readrows_test.go Outdated Show resolved Hide resolved
tests/samplerowkeys_test.go Show resolved Hide resolved
tests/readrows_test.go Show resolved Hide resolved
Co-authored-by: Mattie Fu <mattiefu@google.com>
// Different clients may have different behaviors, we log the delays for informational purpose.
// Example: For the first retry delay, C++ client uses 100ms but Java client uses 10ms.
t.Logf("The three retry delays are: %dms, %dms, %dms", firstDelay, secondDelay, thirdDelay)
for n := 1; n < numRPCs; n += 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

true :) ok

@mutianf mutianf merged commit ca18ae0 into googleapis:main Apr 17, 2024
3 checks passed
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