-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(pubsub): support payload wrapping for push subs #8292
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6e772aa
feat(pubsub): support payload wrapping for push subs
hongalex a380cc7
fix lint issues
hongalex fe64598
fix lint issues
hongalex 2fed630
Merge branch 'main' into pubsub-paylod-unwrapping
hongalex 817cd90
Merge branch 'main' into pubsub-paylod-unwrapping
hongalex a97f68e
Merge branch 'main' into pubsub-paylod-unwrapping
hongalex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ func TestListTopicSubscriptions(t *testing.T) { | |
|
||
const defaultRetentionDuration = 168 * time.Hour | ||
|
||
func TestUpdateSubscription(t *testing.T) { | ||
func TestSubscriptionConfig(t *testing.T) { | ||
ctx := context.Background() | ||
client, srv := newFake(t) | ||
defer client.Close() | ||
|
@@ -191,13 +191,14 @@ func TestUpdateSubscription(t *testing.T) { | |
ServiceAccountEmail: "[email protected]", | ||
Audience: "client-12345", | ||
}, | ||
Wrapper: &PubsubWrapper{}, | ||
}, | ||
EnableExactlyOnceDelivery: false, | ||
State: SubscriptionStateActive, | ||
} | ||
opt := cmpopts.IgnoreUnexported(SubscriptionConfig{}) | ||
if !testutil.Equal(cfg, want, opt) { | ||
t.Fatalf("\ngot %+v\nwant %+v", cfg, want) | ||
if diff := testutil.Diff(cfg, want, opt); diff != "" { | ||
t.Fatalf("compare subscription config mismatch, -got, +want\n%s", diff) | ||
} | ||
|
||
got, err := sub.Update(ctx, SubscriptionConfigToUpdate{ | ||
|
@@ -206,10 +207,13 @@ func TestUpdateSubscription(t *testing.T) { | |
Labels: map[string]string{"label": "value"}, | ||
ExpirationPolicy: 72 * time.Hour, | ||
PushConfig: &PushConfig{ | ||
Endpoint: "https://example.com/push", | ||
Endpoint: "https://example2.com/push", | ||
AuthenticationMethod: &OIDCToken{ | ||
ServiceAccountEmail: "[email protected]", | ||
Audience: "client-12345", | ||
ServiceAccountEmail: "[email protected]", | ||
Audience: "client-98765", | ||
}, | ||
Wrapper: &NoWrapper{ | ||
WriteMetadata: true, | ||
}, | ||
}, | ||
EnableExactlyOnceDelivery: true, | ||
|
@@ -225,17 +229,20 @@ func TestUpdateSubscription(t *testing.T) { | |
Labels: map[string]string{"label": "value"}, | ||
ExpirationPolicy: 72 * time.Hour, | ||
PushConfig: PushConfig{ | ||
Endpoint: "https://example.com/push", | ||
Endpoint: "https://example2.com/push", | ||
AuthenticationMethod: &OIDCToken{ | ||
ServiceAccountEmail: "[email protected]", | ||
Audience: "client-12345", | ||
ServiceAccountEmail: "[email protected]", | ||
Audience: "client-98765", | ||
}, | ||
Wrapper: &NoWrapper{ | ||
WriteMetadata: true, | ||
}, | ||
}, | ||
EnableExactlyOnceDelivery: true, | ||
State: SubscriptionStateActive, | ||
} | ||
if !testutil.Equal(got, want, opt) { | ||
t.Fatalf("\ngot %+v\nwant %+v", got, want) | ||
if diff := testutil.Diff(got, want, opt); diff != "" { | ||
t.Fatalf("compare subscription config mismatch, -got, +want\n%s", diff) | ||
} | ||
|
||
got, err = sub.Update(ctx, SubscriptionConfigToUpdate{ | ||
|
@@ -247,8 +254,8 @@ func TestUpdateSubscription(t *testing.T) { | |
} | ||
want.RetentionDuration = 2 * time.Hour | ||
want.Labels = nil | ||
if !testutil.Equal(got, want, opt) { | ||
t.Fatalf("\ngot %+v\nwant %+v", got, want) | ||
if diff := testutil.Diff(got, want, opt); diff != "" { | ||
t.Fatalf("compare subscription config mismatch, -got, +want\n%s", diff) | ||
} | ||
|
||
_, err = sub.Update(ctx, SubscriptionConfigToUpdate{}) | ||
|
@@ -264,8 +271,8 @@ func TestUpdateSubscription(t *testing.T) { | |
t.Fatal(err) | ||
} | ||
want.ExpirationPolicy = time.Duration(0) | ||
if !testutil.Equal(got, want, opt) { | ||
t.Fatalf("\ngot %+v\nwant %+v", got, want) | ||
if diff := testutil.Diff(got, want, opt); diff != "" { | ||
t.Fatalf("compare subscription config mismatch, -got, +want\n%s", diff) | ||
} | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Defaulting to nil is also acceptable and is treated as PubsubWrapper.
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 is just implementing that behavior in the fake server we provide. The client doesn't know about the default and should default to nil