feat(storage): add update time in bucketAttrs (#10710) · googleapis/google-cloud-go@5f06ae1

@@ -589,6 +589,9 @@ func TestIntegration_BucketUpdate(t *testing.T) {

589589

if !testutil.Equal(attrs.Labels, wantLabels) {

590590

t.Fatalf("add labels: got %v, want %v", attrs.Labels, wantLabels)

591591

}

592+

if !attrs.Created.Before(attrs.Updated) {

593+

t.Errorf("got attrs.Updated %v before attrs.Created %v, want Attrs.Updated to be after", attrs.Updated, attrs.Created)

594+

}

592595593596

// Turn off versioning again; add and remove some more labels.

594597

ua = BucketAttrsToUpdate{VersioningEnabled: false}

@@ -607,6 +610,9 @@ func TestIntegration_BucketUpdate(t *testing.T) {

607610

if !testutil.Equal(attrs.Labels, wantLabels) {

608611

t.Fatalf("got %v, want %v", attrs.Labels, wantLabels)

609612

}

613+

if !attrs.Created.Before(attrs.Updated) {

614+

t.Errorf("got attrs.Updated %v before attrs.Created %v, want Attrs.Updated to be after", attrs.Updated, attrs.Created)

615+

}

610616611617

// Configure a lifecycle

612618

wantLifecycle := Lifecycle{

@@ -626,6 +632,9 @@ func TestIntegration_BucketUpdate(t *testing.T) {

626632

if !testutil.Equal(attrs.Lifecycle, wantLifecycle) {

627633

t.Fatalf("got %v, want %v", attrs.Lifecycle, wantLifecycle)

628634

}

635+

if !attrs.Created.Before(attrs.Updated) {

636+

t.Errorf("got attrs.Updated %v before attrs.Created %v, want Attrs.Updated to be after", attrs.Updated, attrs.Created)

637+

}

629638

// Check that StorageClass has "STANDARD" value for unset field by default

630639

// before passing new value.

631640

wantStorageClass := "STANDARD"

@@ -638,6 +647,9 @@ func TestIntegration_BucketUpdate(t *testing.T) {

638647

if !testutil.Equal(attrs.StorageClass, wantStorageClass) {

639648

t.Fatalf("got %v, want %v", attrs.StorageClass, wantStorageClass)

640649

}

650+

if !attrs.Created.Before(attrs.Updated) {

651+

t.Errorf("got attrs.Updated %v before attrs.Created %v, want Attrs.Updated to be after", attrs.Updated, attrs.Created)

652+

}

641653642654

// Empty update should succeed without changing the bucket.

643655

gotAttrs, err := b.Update(ctx, BucketAttrsToUpdate{})

@@ -647,6 +659,9 @@ func TestIntegration_BucketUpdate(t *testing.T) {

647659

if !testutil.Equal(attrs, gotAttrs) {

648660

t.Fatalf("empty update: got %v, want %v", gotAttrs, attrs)

649661

}

662+

if !attrs.Created.Before(attrs.Updated) {

663+

t.Errorf("got attrs.Updated %v before attrs.Created %v, want Attrs.Updated to be after", attrs.Updated, attrs.Created)

664+

}

650665

})

651666

}

652667