Skip to content
Tracon

RetentionStoreContract

Namespace Tracon.Testing.Contracts.Storage · Assembly Tracon.Testing.Contracts.Xunit.dll

Behavior and tenant isolation tests for the IRetentionStore data plane.

public abstract class RetentionStoreContract : IAsyncLifetime, IAsyncDisposable

objectRetentionStoreContract

IAsyncLifetime, IAsyncDisposable

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

This contract guards against a security defect: a data plane with no tenant filter, where one tenant’s retention policy could delete all tenants’ rows.

The contract does not derive from Storage.TenantIsolationContract: the data plane has no concept of a “record” (there is no write side), seeding goes through the target table’s own store. Isolation is tested directly here.

protected RetentionStoreContract()

The tenant that writes the data.

protected const string TenantA = "tenant-a"

string

The tenant whose data must be preserved.

protected const string TenantB = "tenant-b"

string

The data plane under test.

protected IRetentionStore Store { get; }

IRetentionStore

Archive_read_returns_only_the_given_tenant()

Section titled “ Archive_read_returns_only_the_given_tenant()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RetentionStoreContract.cs", 89)]
public Task Archive_read_returns_only_the_given_tenant()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RetentionStoreContract.cs", 60)]
public Task Count_covers_only_the_given_tenant()

Task

Produces an empty data plane for testing.

protected abstract ValueTask<IRetentionStore> CreateStoreAsync()

ValueTask<IRetentionStore>

A store ready for use.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RetentionStoreContract.cs", 73)]
public Task Delete_does_NOT_touch_the_others_data()

Task

public ValueTask DisposeAsync()

ValueTask

Called immediately after the class has been created, before it is used.

public ValueTask InitializeAsync()

ValueTask

Hook for the derived class to release its own resources.

protected virtual ValueTask OnDisposeAsync()

ValueTask

The completion task.

Row_limit_threshold_counts_only_the_given_tenant()

Section titled “ Row_limit_threshold_counts_only_the_given_tenant()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RetentionStoreContract.cs", 104)]
public Task Row_limit_threshold_counts_only_the_given_tenant()

Task

Writes a row for the given tenant, older than the cutoff date, that falls under the RetentionTargets.VoiceSessions target.

protected abstract ValueTask SeedOldRowAsync(string tenantId)

tenantId string

The tenant that owns the row.

ValueTask

The completion task.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RetentionStoreContract.cs", 119)]
public Task Unknown_target_throws()

Task