public void TestEnableBucketLifecycleManagement()
    {
        var enableBucketLifecycleManagementSample  = new EnableBucketLifecycleManagementSample();
        var disableBucketLifecycleManagementSample = new DisableBucketLifecycleManagementSample();

        // Enable bucket lifecycle management.
        var bucket = enableBucketLifecycleManagementSample.EnableBucketLifecycleManagement(_fixture.BucketNameGeneric);

        _fixture.SleepAfterBucketCreateUpdateDelete();
        Assert.Contains(bucket.Lifecycle.Rule, r => r.Condition.Age == 100 && r.Action.Type == "Delete");

        // Disable bucket lifecycle management.
        disableBucketLifecycleManagementSample.DisableBucketLifecycleManagement(_fixture.BucketNameGeneric);
        _fixture.SleepAfterBucketCreateUpdateDelete();
    }
Example #2
0
    public void TestDisableBucketLifecycleManagement()
    {
        EnableBucketLifecycleManagementSample  enableBucketLifecycleManagementSample  = new EnableBucketLifecycleManagementSample();
        DisableBucketLifecycleManagementSample disableBucketLifecycleManagementSample = new DisableBucketLifecycleManagementSample();

        // Enable bucket lifecycle management.
        enableBucketLifecycleManagementSample.EnableBucketLifecycleManagement(_bucketFixture.BucketNameGeneric);
        _bucketFixture.SleepAfterBucketCreateUpdateDelete();

        // Disable bucket lifecycle management.
        var bucket = disableBucketLifecycleManagementSample.DisableBucketLifecycleManagement(_bucketFixture.BucketNameGeneric);

        _bucketFixture.SleepAfterBucketCreateUpdateDelete();
        Assert.Null(bucket.Lifecycle);
    }