-
Notifications
You must be signed in to change notification settings - Fork 11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,17 +336,18 @@ func TestMutateRows_Retry_ExponentialBackoff(t *testing.T) { | |
|
||
// 4b. Log the retry delays | ||
origReq := <-recorder | ||
firstRetry := <-recorder | ||
secondRetry := <-recorder | ||
thirdRetry := <-recorder | ||
|
||
firstDelay := int(firstRetry.ts.UnixMilli() - origReq.ts.UnixMilli()) | ||
secondDelay := int(secondRetry.ts.UnixMilli() - firstRetry.ts.UnixMilli()) | ||
thirdDelay := int(thirdRetry.ts.UnixMilli() - secondRetry.ts.UnixMilli()) | ||
|
||
// 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an assertion for this above,
This lines are not functionally part of the test, they just seem to output debugging information. There are no assertions here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true :) ok |
||
select { | ||
case retry := <- recorder: | ||
delay := int(retry.ts.UnixMilli() - origReq.ts.UnixMilli()) | ||
// 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("Retry #%d delay: %dms", n, delay) | ||
case <-time.After(500 * time.Millisecond): | ||
t.Logf("Retry #%d: Timeout waiting for retry (expecting %d retries)", n, numRPCs - 1) | ||
} | ||
} | ||
} | ||
|
||
// TestMutateRows_Generic_MultiStreams tests that client can have multiple concurrent streams. | ||
|
@@ -496,14 +497,19 @@ func TestMutateRows_Retry_WithRoutingCookie(t *testing.T) { | |
// 4b. Verify routing cookie is seen | ||
// Ignore the first metadata which won't have the routing cookie | ||
var _ = <-mdRecorder | ||
// second metadata which comes from the retry attempt should have a routing cookie field | ||
md1 := <-mdRecorder | ||
val := md1["x-goog-cbt-cookie-test"] | ||
assert.NotEmpty(t, val) | ||
if len(val) == 0 { | ||
return | ||
} | ||
assert.Equal(t, cookie, val[0]) | ||
|
||
select { | ||
mutianf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case md1 := <-mdRecorder: | ||
// second metadata which comes from the retry attempt should have a routing cookie field | ||
val := md1["x-goog-cbt-cookie-test"] | ||
assert.NotEmpty(t, val) | ||
if len(val) == 0 { | ||
return | ||
} | ||
assert.Equal(t, cookie, val[0]) | ||
case <- time.After(100 * time.Millisecond): | ||
t.Error("Timeout waiting for requests on recorder channel") | ||
} | ||
} | ||
|
||
// TestMutateRows_Retry_WithRetryInfo tests that client is handling RetryInfo correctly. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,10 +136,8 @@ func TestReadRows_ReverseScans_FeatureFlag_Enabled(t *testing.T) { | |
md := <-mdRecords | ||
|
||
ff, err := getClientFeatureFlags(md) | ||
|
||
assert.Nil(t, err, "failed to decode client feature flags") | ||
|
||
assert.True(t, ff.ReverseScans, "client does must enable ReverseScans feature flag") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was segfaulting when |
||
assert.True(t, ff != nil && ff.ReverseScans, "client must enable ReverseScans feature flag") | ||
} | ||
|
||
// TestReadRows_NoRetry_OutOfOrderError_Reverse tests that client will fail on receiving out of order row keys for reverse scans. | ||
|
@@ -892,8 +890,13 @@ func TestReadRows_Retry_WithRoutingCookie_MultipleErrorResponses(t *testing.T) { | |
// 4a. Verify that the read succeeds | ||
checkResultOkStatus(t, res) | ||
assert.Equal(t, 2, len(res.GetRows())) | ||
assert.Equal(t, "row-01", string(res.Rows[0].Key)) | ||
mutianf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert.Equal(t, "row-05", string(res.Rows[1].Key)) | ||
if len(res.GetRows()) > 0 { | ||
assert.Equal(t, "row-01", string(res.Rows[0].Key)) | ||
} | ||
|
||
if len(res.GetRows()) > 1 { | ||
assert.Equal(t, "row-05", string(res.Rows[1].Key)) | ||
} | ||
|
||
// 4b. Verify routing cookie is seen | ||
// Ignore the first metadata which won't have the routing cookie | ||
|
There was a problem hiding this comment.
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.