Skip to content
Tracon

SingletonLeaseStoreContract

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

Behavior tests for the ISingletonLeaseStore contract.

public abstract class SingletonLeaseStoreContract : IAsyncLifetime, IAsyncDisposable

objectSingletonLeaseStoreContract

IAsyncLifetime, IAsyncDisposable

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

The in-memory store and the three SQL providers must pass the same scenarios. The lease-expiry test runs against real time (a short lease plus a short wait): the SQL implementations do not take their clock from an injectable TimeProvider – the same reason as JobStoreContract.

There is no tenant concept here: single-executor election is a deployment-wide concern. This is why the contract derives directly from Xunit.IAsyncLifetime rather than from Storage.TenantIsolationContract – the same pattern as RetentionStoreContract.

protected SingletonLeaseStoreContract()

The lease store under test.

protected ISingletonLeaseStore Store { get; }

ISingletonLeaseStore

Produces an empty lease store for the test.

protected abstract ValueTask<ISingletonLeaseStore> CreateStoreAsync()

ValueTask<ISingletonLeaseStore>

A store ready for use.

public ValueTask DisposeAsync()

ValueTask

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SingletonLeaseStoreContract.cs", 49)]
public Task Empty_lease_can_be_acquired()

Task

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

public ValueTask InitializeAsync()

ValueTask

Hook for a derived class to release its own resources.

protected virtual ValueTask OnDisposeAsync()

ValueTask

A completed task.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SingletonLeaseStoreContract.cs", 88)]
public Task Owner_can_renew_its_lease()

Task

ReleaseAsync_by_a_non_owner_does_nothing()

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

Task

Released_lease_can_be_reacquired_immediately_by_someone_else()

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

Task

RenewAsync_returns_false_for_a_non_owner()

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

Task

RenewAsync_returns_false_once_the_lease_has_passed_to_someone_else()

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

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SingletonLeaseStoreContract.cs", 66)]
public Task Same_owner_can_reacquire_its_own_lease()

Task

Second_owner_cannot_acquire_while_lease_is_held()

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

Task

Someone_else_can_acquire_once_the_lease_expires()

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

Task