Example #1
0
    public void TestSetRetentionPolicy()
    {
        SetRetentionPolicySample    setRetentionPolicySample    = new SetRetentionPolicySample();
        RemoveRetentionPolicySample removeRetentionPolicySample = new RemoveRetentionPolicySample();
        var retentionPeriod = 5;

        // Set retention policy.
        var retentionPolicy = setRetentionPolicySample.SetRetentionPolicy(_fixture.BucketNameGeneric, retentionPeriod);

        _fixture.SleepAfterBucketCreateUpdateDelete();
        Assert.Equal(retentionPolicy.RetentionPeriod, retentionPeriod);

        // Remove retention policy.
        removeRetentionPolicySample.RemoveRetentionPolicy(_fixture.BucketNameGeneric);
        _fixture.SleepAfterBucketCreateUpdateDelete();
    }
Example #2
0
    public void TestRemoveRetentionPolicy()
    {
        GetRetentionPolicySample    getRetentionPolicySample    = new GetRetentionPolicySample();
        SetRetentionPolicySample    setRetentionPolicySample    = new SetRetentionPolicySample();
        RemoveRetentionPolicySample removeRetentionPolicySample = new RemoveRetentionPolicySample();
        var retentionPeriod = 5;

        // Set retention policy.
        setRetentionPolicySample.SetRetentionPolicy(_fixture.BucketNameGeneric, retentionPeriod);
        _fixture.SleepAfterBucketCreateUpdateDelete();

        // Remove retention policy.
        removeRetentionPolicySample.RemoveRetentionPolicy(_fixture.BucketNameGeneric);
        _fixture.SleepAfterBucketCreateUpdateDelete();
        var result = getRetentionPolicySample.GetRetentionPolicy(_fixture.BucketNameGeneric);

        Assert.Null(result);
    }