Skip to content
Tracon

TraceStoreContract

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

Behavior tests for the ITraceStore contract.

public abstract class TraceStoreContract : TenantIsolationContract<ITraceStore>, IAsyncLifetime, IAsyncDisposable

objectTenantIsolationContract<ITraceStore>TraceStoreContract

IAsyncLifetime, IAsyncDisposable

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

Because span ids are derived from W3C ids, writing the same span twice must not produce a duplicate record; every implementation must satisfy this rule.

protected TraceStoreContract()

The tenant spans are written under. The store reads its own tenant context; if the write and read tenants do not match, the trace can never be found. This is why the value comes from the same source as the ambient tenant.

protected string TenantId { get; }

string

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/TraceStoreContract.cs", 105)]
public Task Attributes_are_preserved()

Task

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.

The span store has no listing endpoint; the count is reduced to how many of the runs seeded for that tenant are visible.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/TraceStoreContract.cs", 153)]
public Task Empty_set_is_not_written()

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.

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.

The write takes the tenant from the batch, the read from ITenantContext; if the two diverge, the trace can never be found.

Opens a run for spans to attach to.

protected abstract ValueTask SeedRunAsync(Guid runId)

runId Guid

The run id.

ValueTask

A completed task.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/TraceStoreContract.cs", 81)]
public Task Span_tree_round_trips()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/TraceStoreContract.cs", 149)]
public Task Unrecorded_run_returns_empty()

Task

Writing_the_same_span_twice_does_not_create_a_duplicate()

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

Task