@@ -58,6 +58,10 @@ func TestCreateScratchBucketNoSourceFileDefaultBucketCreatedBasedOnDefaultRegion
5858 SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
5959 }).Return (nil )
6060
61+ mockStorageClient .EXPECT ().UpdateBucket (expectedBucket , storage.BucketAttrsToUpdate {
62+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
63+ }).Return (nil )
64+
6165 c := ScratchBucketCreator {mockStorageClient , ctx , createMockBucketIteratorWithRandomBuckets (mockCtrl , & ctx , mockStorageClient , project )}
6266 bucket , region , err := c .CreateScratchBucket ("" , project , "" , true )
6367 assert .Equal (t , expectedBucket , bucket )
@@ -83,6 +87,10 @@ func TestCreateScratchBucketNoSourceFileTranslateGoogleDomainDefaultBucketCreate
8387 SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
8488 }).Return (nil )
8589
90+ mockStorageClient .EXPECT ().UpdateBucket (expectedBucket , storage.BucketAttrsToUpdate {
91+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
92+ }).Return (nil )
93+
8694 c := ScratchBucketCreator {mockStorageClient , ctx , createMockBucketIteratorWithRandomBuckets (mockCtrl , & ctx , mockStorageClient , project )}
8795 bucket , region , err := c .CreateScratchBucket ("" , project , "" , true )
8896 assert .Equal (t , expectedBucket , bucket )
@@ -108,6 +116,10 @@ func TestCreateScratchBucketNoSourceFileBucketCreatedBasedOnInputZone(t *testing
108116 SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
109117 }).Return (nil )
110118
119+ mockStorageClient .EXPECT ().UpdateBucket (expectedBucket , storage.BucketAttrsToUpdate {
120+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
121+ }).Return (nil )
122+
111123 c := ScratchBucketCreator {mockStorageClient , ctx , createMockBucketIteratorWithRandomBuckets (mockCtrl , & ctx , mockStorageClient , project )}
112124 bucket , region , err := c .CreateScratchBucket ("" , project , "asia-east1-b" , true )
113125 assert .Equal (t , expectedBucket , bucket )
@@ -173,7 +185,9 @@ func TestCreateScratchBucketNewBucketCreatedProject(t *testing.T) {
173185 mockStorageClient := mocks .NewMockStorageClientInterface (mockCtrl )
174186 mockStorageClient .EXPECT ().GetBucketAttrs (sourceBucketAttrs .Name ).Return (sourceBucketAttrs , nil ).Times (1 )
175187 mockStorageClient .EXPECT ().CreateBucket ("project1-daisy-bkt-us-west2" , project , scratchBucketAttrs ).Return (nil ).Times (1 )
176-
188+ mockStorageClient .EXPECT ().UpdateBucket ("project1-daisy-bkt-us-west2" , storage.BucketAttrsToUpdate {
189+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
190+ }).Return (nil ).Times (1 )
177191 mockBucketIterator := mocks .NewMockBucketIteratorInterface (mockCtrl )
178192 first := mockBucketIterator .EXPECT ().Next ().Return (anotherBucketAttrs , nil )
179193 second := mockBucketIterator .EXPECT ().Next ().Return (sourceBucketAttrs , nil )
@@ -230,6 +244,9 @@ func TestCreateScratchBucketErrorRetrievingSourceFileBucketMetadataDefaultBucket
230244 SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
231245 }).Return (nil )
232246
247+ mockStorageClient .EXPECT ().UpdateBucket (expectedBucket , storage.BucketAttrsToUpdate {
248+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
249+ }).Return (nil ).Times (1 )
233250 c := ScratchBucketCreator {mockStorageClient , ctx , createMockBucketIteratorWithRandomBuckets (mockCtrl , & ctx , mockStorageClient , project )}
234251 bucket , region , err := c .CreateScratchBucket ("gs://sourcebucket/sourcefile" , project , "" , true )
235252 assert .Equal (t , expectedBucket , bucket )
@@ -256,6 +273,10 @@ func TestCreateScratchBucketErrorRetrievingSourceFileBucketMetadataBucketCreated
256273 SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
257274 }).Return (nil )
258275
276+ mockStorageClient .EXPECT ().UpdateBucket (expectedBucket , storage.BucketAttrsToUpdate {
277+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
278+ }).Return (nil )
279+
259280 c := ScratchBucketCreator {mockStorageClient , ctx , createMockBucketIteratorWithRandomBuckets (mockCtrl , & ctx , mockStorageClient , project )}
260281 bucket , region , err := c .CreateScratchBucket ("gs://sourcebucket/sourcefile" , project , "asia-east1-b" , true )
261282 assert .Equal (t , expectedBucket , bucket )
@@ -282,6 +303,10 @@ func TestCreateScratchBucketNilSourceFileBucketMetadataDefaultBucketCreated(t *t
282303 SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
283304 }).Return (nil )
284305
306+ mockStorageClient .EXPECT ().UpdateBucket (expectedBucket , storage.BucketAttrsToUpdate {
307+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
308+ }).Return (nil )
309+
285310 c := ScratchBucketCreator {mockStorageClient , ctx , createMockBucketIteratorWithRandomBuckets (mockCtrl , & ctx , mockStorageClient , project )}
286311 bucket , region , err := c .CreateScratchBucket ("gs://sourcebucket/sourcefile" , project , "" , true )
287312 assert .Equal (t , expectedBucket , bucket )
@@ -356,6 +381,9 @@ func TestCreateScratchBucketReturnsExistingScratchBucketNoCreate(t *testing.T) {
356381 Return (mockBucketIterator ).
357382 Times (1 )
358383
384+ mockStorageClient .EXPECT ().UpdateBucket ("project1-daisy-bkt-us-west2" , storage.BucketAttrsToUpdate {
385+ SoftDeletePolicy : & storage.SoftDeletePolicy {RetentionDuration : 0 },
386+ }).Return (nil ).Times (1 )
359387 c := ScratchBucketCreator {mockStorageClient , ctx , mockBucketIteratorCreator }
360388 bucket , region , err := c .CreateScratchBucket ("gs://sourcebucket/sourcefile" , projectID , "" , true )
361389 assert .Equal (t , "project1-daisy-bkt-us-west2" , bucket )
0 commit comments