@@ -154,7 +154,7 @@ func TestListTopicSubscriptions(t *testing.T) {
154154
155155const defaultRetentionDuration = 168 * time .Hour
156156
157- func TestUpdateSubscription (t * testing.T ) {
157+ func TestSubscriptionConfig (t * testing.T ) {
158158 ctx := context .Background ()
159159 client , srv := newFake (t )
160160 defer client .Close ()
@@ -191,13 +191,14 @@ func TestUpdateSubscription(t *testing.T) {
191191 ServiceAccountEmail : "foo@example.com" ,
192192 Audience : "client-12345" ,
193193 },
194+ Wrapper : & PubsubWrapper {},
194195 },
195196 EnableExactlyOnceDelivery : false ,
196197 State : SubscriptionStateActive ,
197198 }
198199 opt := cmpopts .IgnoreUnexported (SubscriptionConfig {})
199- if ! testutil .Equal (cfg , want , opt ) {
200- t .Fatalf ("\n got %+v \n want %+v" , cfg , want )
200+ if diff := testutil .Diff (cfg , want , opt ); diff != "" {
201+ t .Fatalf ("compare subscription config mismatch, -got, + want\n %s" , diff )
201202 }
202203
203204 got , err := sub .Update (ctx , SubscriptionConfigToUpdate {
@@ -206,10 +207,13 @@ func TestUpdateSubscription(t *testing.T) {
206207 Labels : map [string ]string {"label" : "value" },
207208 ExpirationPolicy : 72 * time .Hour ,
208209 PushConfig : & PushConfig {
209- Endpoint : "https://example .com/push" ,
210+ Endpoint : "https://example2 .com/push" ,
210211 AuthenticationMethod : & OIDCToken {
211- ServiceAccountEmail : "foo@example.com" ,
212- Audience : "client-12345" ,
212+ ServiceAccountEmail : "bar@example.com" ,
213+ Audience : "client-98765" ,
214+ },
215+ Wrapper : & NoWrapper {
216+ WriteMetadata : true ,
213217 },
214218 },
215219 EnableExactlyOnceDelivery : true ,
@@ -225,17 +229,20 @@ func TestUpdateSubscription(t *testing.T) {
225229 Labels : map [string ]string {"label" : "value" },
226230 ExpirationPolicy : 72 * time .Hour ,
227231 PushConfig : PushConfig {
228- Endpoint : "https://example .com/push" ,
232+ Endpoint : "https://example2 .com/push" ,
229233 AuthenticationMethod : & OIDCToken {
230- ServiceAccountEmail : "foo@example.com" ,
231- Audience : "client-12345" ,
234+ ServiceAccountEmail : "bar@example.com" ,
235+ Audience : "client-98765" ,
236+ },
237+ Wrapper : & NoWrapper {
238+ WriteMetadata : true ,
232239 },
233240 },
234241 EnableExactlyOnceDelivery : true ,
235242 State : SubscriptionStateActive ,
236243 }
237- if ! testutil .Equal (got , want , opt ) {
238- t .Fatalf ("\n got %+v \n want %+v" , got , want )
244+ if diff := testutil .Diff (got , want , opt ); diff != "" {
245+ t .Fatalf ("compare subscription config mismatch, - got, + want\n %s" , diff )
239246 }
240247
241248 got , err = sub .Update (ctx , SubscriptionConfigToUpdate {
@@ -247,8 +254,8 @@ func TestUpdateSubscription(t *testing.T) {
247254 }
248255 want .RetentionDuration = 2 * time .Hour
249256 want .Labels = nil
250- if ! testutil .Equal (got , want , opt ) {
251- t .Fatalf ("\n got %+v \n want %+v" , got , want )
257+ if diff := testutil .Diff (got , want , opt ); diff != "" {
258+ t .Fatalf ("compare subscription config mismatch, - got, + want\n %s" , diff )
252259 }
253260
254261 _ , err = sub .Update (ctx , SubscriptionConfigToUpdate {})
@@ -264,8 +271,8 @@ func TestUpdateSubscription(t *testing.T) {
264271 t .Fatal (err )
265272 }
266273 want .ExpirationPolicy = time .Duration (0 )
267- if ! testutil .Equal (got , want , opt ) {
268- t .Fatalf ("\n got %+v \n want %+v" , got , want )
274+ if diff := testutil .Diff (got , want , opt ); diff != "" {
275+ t .Fatalf ("compare subscription config mismatch, - got, + want\n %s" , diff )
269276 }
270277}
271278
0 commit comments