Skip to content
Tracon

TenantEgressPolicyStoreContract

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

Behavior tests for the ITenantEgressPolicyStore contract.

public abstract class TenantEgressPolicyStoreContract : TenantIsolationContract<ITenantEgressPolicyStore>, IAsyncLifetime, IAsyncDisposable

objectTenantIsolationContract<ITenantEgressPolicyStore>TenantEgressPolicyStoreContract

IAsyncLifetime, IAsyncDisposable

TenantIsolationContract<ITenantEgressPolicyStore>.TenantA, TenantIsolationContract<ITenantEgressPolicyStore>.TenantB, TenantIsolationContract<ITenantEgressPolicyStore>.CreateStoreAsync(), TenantIsolationContract<ITenantEgressPolicyStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<ITenantEgressPolicyStore>.InitializeAsync(), TenantIsolationContract<ITenantEgressPolicyStore>.DisposeAsync(), TenantIsolationContract<ITenantEgressPolicyStore>.OnDisposeAsync(), TenantIsolationContract<ITenantEgressPolicyStore>.SeedAsync(string, string), TenantIsolationContract<ITenantEgressPolicyStore>.ExistsAsync(string, object), TenantIsolationContract<ITenantEgressPolicyStore>.CountAsync(string), TenantIsolationContract<ITenantEgressPolicyStore>.TryDeleteAsync(string, object), TenantIsolationContract<ITenantEgressPolicyStore>.TryOverwriteAsync(string, string), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_reads_its_own_record(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<ITenantEgressPolicyStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<ITenantEgressPolicyStore>.AmbientTenant, TenantIsolationContract<ITenantEgressPolicyStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

A tenant carries at most ONE policy (there is no “name” dimension), so the isolation base’s generic name parameter is ignored here; every scenario still proves the SAME thing the other store contracts do: tenant A’s policy is invisible to and unwritable by tenant B.

protected TenantEgressPolicyStoreContract()

Reports how many records the given tenant sees through the listing endpoint.

protected override ValueTask<int> CountAsync(string tenantId)

tenantId string

The reading tenant.

ValueTask<int>

The number of records seen.

Deleting_the_policy_makes_the_tenant_unrestricted_again()

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

Task

Reports whether the record is visible from the given tenant’s viewpoint.

protected override ValueTask<bool> ExistsAsync(string tenantId, object key)

tenantId string

The reading tenant.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool>

true if the record is visible.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/TenantEgressPolicyStoreContract.cs", 34)]
public Task Saved_policy_is_read_back()

Task

Writes a sample record for the given tenant.

protected override ValueTask<object> SeedAsync(string tenantId, string name)

tenantId string

The tenant that owns the record.

name string

The name distinguishing the record. The same name may be used by two tenants.

ValueTask<object>

The key to use for reading the record back.

Tenant_with_no_saved_policy_is_unrestricted()

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

Task

Attempts to delete the record on behalf of the given tenant.

protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)

tenantId string

The tenant attempting the delete.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool?>

true if the delete succeeded, false if the record was not found; null if the store does not offer deletion.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/TenantEgressPolicyStoreContract.cs", 50)]
public Task Upsert_replaces_the_existing_policy()

Task