Skip to content

Commit

Permalink
test(pubsub): remove brittle custom retry test (googleapis#8443)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongalex authored Aug 18, 2023
1 parent 37cccaf commit 5165630
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions pubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package pubsub

import (
"context"
"fmt"
"testing"
"time"

Expand All @@ -30,41 +29,6 @@ import (
"google.golang.org/grpc/status"
)

func TestClient_CustomRetry(t *testing.T) {
ctx := context.Background()
pco := &vkit.PublisherCallOptions{
Publish: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.Unavailable, codes.DeadlineExceeded,
}, gax.Backoff{
Initial: 200 * time.Millisecond,
Max: 30000 * time.Millisecond,
Multiplier: 1.25,
})
}),
},
}
sco := &vkit.SubscriberCallOptions{}
c, err := NewClientWithConfig(ctx, "some-project", &ClientConfig{PublisherCallOptions: pco, SubscriberCallOptions: sco})
if err != nil {
t.Fatalf("failed to create client with config: %v", err)
}

cs := &gax.CallSettings{}
// This is the default retry setting.
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[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)
}
}

func TestClient_ApplyClientConfig(t *testing.T) {
ctx := context.Background()
srv := pstest.NewServer()
Expand Down

0 comments on commit 5165630

Please sign in to comment.