Skip to content

Commit

Permalink
pubsub: add test for specifying a bad custom endpoint
Browse files Browse the repository at this point in the history
Change-Id: Idf6a73970f77f311294730d63bd1922c40a2f36a
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/54270
Reviewed-by: kokoro <[email protected]>
Reviewed-by: Cody Oss <[email protected]>
  • Loading branch information
hongalex committed Apr 2, 2020
1 parent 83fd49a commit ad3d95a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pubsub/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1517,3 +1517,20 @@ func TestIntegration_DeadLetterPolicy_ClearDeadLetter(t *testing.T) {
t.Fatalf("SubsciptionConfig; got: - want: +\n%s", diff)
}
}

// TestIntegration_BadEndpoint tests that specifying a bad
// endpoint will cause an error in RPCs.
func TestIntegration_BadEndpoint(t *testing.T) {
t.Parallel()
ctx := context.Background()
opts := withGRPCHeadersAssertion(t,
option.WithEndpoint("example.googleapis.com:443"),
)
client, err := NewClient(ctx, testutil.ProjID(), opts...)
if err != nil {
t.Fatalf("Creating client error: %v", err)
}
if _, err = client.CreateTopic(ctx, topicIDs.New()); err == nil {
t.Fatalf("CreateTopic should fail with fake endpoint, got nil err")
}
}

0 comments on commit ad3d95a

Please sign in to comment.