Skip to content

Commit

Permalink
test: fix brittle tests (#8166)
Browse files Browse the repository at this point in the history
These tests relied on the fact that the retry option was the first. It is likely in the future orders will change even more so these tests should eventually be written or removed. We should exercies that retries work more generally if we don't already.

Fixes: #8095
Fixes: #8146
  • Loading branch information
codyoss authored Jun 22, 2023
1 parent 8424e7e commit 4a9c124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func TestClient_CustomRetry(t *testing.T) {

cs := &gax.CallSettings{}
// This is the default retry setting.
c.pubc.CallOptions.Publish[0].Resolve(cs)
c.pubc.CallOptions.Publish[1].Resolve(cs)
if got, want := fmt.Sprintf("%v", cs.Retry()), "&{{100000000 60000000000 1.3 0} [10 1 13 8 2 14 4]}"; got != want {
t.Fatalf("got: %v, want: %v", got, want)
}

// This is the custom retry setting.
c.pubc.CallOptions.Publish[1].Resolve(cs)
c.pubc.CallOptions.Publish[2].Resolve(cs)
if got, want := fmt.Sprintf("%v", cs.Retry()), "&{{200000000 30000000000 1.25 0} [14 4]}"; got != want {
t.Fatalf("merged CallOptions is incorrect: got %v, want %v", got, want)
}
Expand Down
4 changes: 2 additions & 2 deletions spanner/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2736,13 +2736,13 @@ func TestClient_CallOptions(t *testing.T) {

cs := &gax.CallSettings{}
// This is the default retry setting.
c.CallOptions.CreateSession[0].Resolve(cs)
c.CallOptions.CreateSession[1].Resolve(cs)
if got, want := fmt.Sprintf("%v", cs.Retry()), "&{{250000000 32000000000 1.3 0} [14]}"; got != want {
t.Fatalf("merged CallOptions is incorrect: got %v, want %v", got, want)
}

// This is the custom retry setting.
c.CallOptions.CreateSession[1].Resolve(cs)
c.CallOptions.CreateSession[2].Resolve(cs)
if got, want := fmt.Sprintf("%v", cs.Retry()), "&{{200000000 30000000000 1.25 0} [14 4]}"; got != want {
t.Fatalf("merged CallOptions is incorrect: got %v, want %v", got, want)
}
Expand Down

0 comments on commit 4a9c124

Please sign in to comment.