Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pubsub/pstest/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,10 @@ func (s *GServer) CreateSubscription(_ context.Context, ps *pb.Subscription) (*p
if ps.PushConfig == nil {
ps.PushConfig = &pb.PushConfig{}
}
if ps.BigqueryConfig == nil {
ps.BigqueryConfig = &pb.BigQueryConfig{}
} else if ps.BigqueryConfig.Table != "" {
// Consider any table set to mean the config is active.
// We don't convert nil config to empty like with PushConfig above
// as this mimics the live service behavior.
if ps.GetBigqueryConfig() != nil && ps.GetBigqueryConfig().GetTable() != "" {
ps.BigqueryConfig.State = pb.BigQueryConfig_ACTIVE
}
ps.TopicMessageRetentionDuration = top.proto.MessageRetentionDuration
Expand Down Expand Up @@ -605,7 +606,7 @@ func (s *GServer) UpdateSubscription(_ context.Context, req *pb.UpdateSubscripti
sub.proto.PushConfig = req.Subscription.PushConfig

case "bigquery_config":
// If bq config is nil here, it will have been cleared.
// If bq config is nil here, it will be cleared.
// Otherwise, we'll consider the subscription active if any table is set.
sub.proto.BigqueryConfig = req.GetSubscription().GetBigqueryConfig()
if sub.proto.GetBigqueryConfig() != nil {
Expand Down
4 changes: 2 additions & 2 deletions pubsub/pstest/fake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1583,8 +1583,8 @@ func TestSubscriptionPushPull(t *testing.T) {
if diff := testutil.Diff(got.PushConfig, new(pb.PushConfig)); diff != "" {
t.Errorf("sub.PushConfig should be zero value\n%s", diff)
}
if diff := testutil.Diff(got.BigqueryConfig, new(pb.BigQueryConfig)); diff != "" {
t.Errorf("sub.BigqueryConfig should be zero value\n%s", diff)
if got.BigqueryConfig != nil {
t.Errorf("sub.BigqueryConfig should be nil, got %s", got.BigqueryConfig)
}
}

Expand Down
⌂ 换网址