Skip to content

PostgresTestInstallation

Namespace: Ankus.Testing

Assembly: Ankus.Testing.dll

Owns a relocatable copy of a PostgreSQL installation for isolated extension tests.

public sealed class PostgresTestInstallation : IAsyncDisposable

Inheritance: object

Implements: IAsyncDisposable

Deletes the staged installation after the servers using it have stopped.

public ValueTask DisposeAsync()

Returns: ValueTask

A completed task after synchronous file cleanup.

On Windows, a stopped server’s exiting processes can briefly keep the staged executables and libraries open; deletion retries as Delete(string) describes.

Copies the publication manifest’s declared control and SQL files into this isolated installation. Native libraries can remain in the publish directory and be selected with dynamic_library_path. Custom SQL directories are remapped inside this installation without changing the publication.

public void InstallExtensionFiles(string publishDirectory)

Parameters:

publishDirectory — string

The Ankus publish directory.

StageAsync(PostgresInstallation, string, CancellationToken)

Section titled “StageAsync(PostgresInstallation, string, CancellationToken)”

Copies PostgreSQL into a relocatable staging root without changing the source installation.

public static Task<PostgresTestInstallation> StageAsync(PostgresInstallation installation, string rootDirectory, CancellationToken cancellationToken = default)

Parameters:

installation — PostgresInstallation

The source PostgreSQL installation.

rootDirectory — string

An empty directory to own as the staging root.

cancellationToken — CancellationToken

Cancels file staging and PostgreSQL inspection.

Returns: Task<PostgresTestInstallation>

The staged installation owner.

Gets the relocated PostgreSQL installation.

public PostgresInstallation Installation { get; }

Value: PostgresInstallation

Gets the staging root owned by this instance.

public string RootDirectory { get; }

Value: string