Closed
Description
From this Kokoro failure:
________________________ test_bucket_w_retention_period ________________________
storage_client = <google.cloud.storage.client.Client object at 0x7f229517cd10>
buckets_to_delete = [<Bucket: w-retention-period-1629442620182>]
blobs_to_delete = [<Blob: w-retention-period-1629442620182, test-blob, 1629442620932109>]
def test_bucket_w_retention_period(
storage_client, buckets_to_delete, blobs_to_delete,
):
period_secs = 10
bucket_name = _helpers.unique_name("w-retention-period")
bucket = _helpers.retry_429_503(storage_client.create_bucket)(bucket_name)
buckets_to_delete.append(bucket)
bucket.retention_period = period_secs
bucket.default_event_based_hold = False
bucket.patch()
assert bucket.retention_period == period_secs
assert isinstance(bucket.retention_policy_effective_time, datetime.datetime)
assert not bucket.default_event_based_hold
assert not bucket.retention_policy_locked
blob_name = "test-blob"
payload = b"DEADBEEF"
blob = bucket.blob(blob_name)
blob.upload_from_string(payload)
blobs_to_delete.append(blob)
other = bucket.get_blob(blob_name)
assert not other.event_based_hold
assert not other.temporary_hold
assert isinstance(other.retention_expiration_time, datetime.datetime)
with pytest.raises(exceptions.Forbidden):
other.delete()
bucket.retention_period = None
bucket.patch()
assert bucket.retention_period is None
assert bucket.retention_policy_effective_time is None
assert not bucket.default_event_based_hold
assert not bucket.retention_policy_locked
other.reload()
assert not other.event_based_hold
assert not other.temporary_hold
> assert other.retention_expiration_time is None
E assert datetime.datetime(2021, 8, 20, 6, 57, 10, 949000, tzinfo=<UTC>) is None
E + where datetime.datetime(2021, 8, 20, 6, 57, 10, 949000, tzinfo=<UTC>) = <Blob: w-retention-period-1629442620182, test-blob, 1629442620932109>.retention_expiration_time
tests/system/test_bucket.py:572: AssertionError