skipcheck

TM1 Testcontainers · Docs · Containers

Tm1AdminServerContainer

using Skipcheck.Tm1.Testcontainers;

A TM1 Admin Server on its own, for tests with several TM1 servers: the tm1-server image in admin mode. TM1 servers register with it through Tm1ServerContainer.WithAdminServer, and Tm1WebContainer and PawContainer list them all from it.

await using var admin = new Tm1AdminServerContainer(tm1Source);
await using var planning = new Tm1ServerContainer(tm1Source).WithEnv("TM1_SERVER_NAME", "planning").WithAdminServer(admin);
await using var reporting = new Tm1ServerContainer(tm1Source).WithEnv("TM1_SERVER_NAME", "reporting").WithAdminServer(admin);
await planning.StartAsync();
await reporting.StartAsync();
return admin.RestUrl + "Servers"; // lists planning and reporting

The Admin Server is part of the TM1 install, so it takes the same Tm1Source. Other containers reach it on their shared network as tm1-admin.

Members

RestPort staticThe Admin Server's REST port.
NetworkAlias staticIts name on the network.
Tm1AdminServerContainer constructorAn Admin Server from source, in the image TM1 runs in.
Tm1AdminServerContainer constructorAn Admin Server from source, in image.
Source propertyWhere TM1 comes from.
RestUrl propertyThe Admin Server's REST root, http://host:port/api/v1/.
DockerImageName propertyThe image it runs.
EnvMap propertyIts environment variables, so far.
CommandParts propertyThe command it runs, if not the image's.
ExposedPorts propertyThe ports it exposes on the Docker host.
Network propertyThe network it joins, or null for Docker's default bridge.
NetworkAliases propertyIts names on Network.
Dependencies propertyWhat starts before it.
Container propertyThe started container.
IsRunning property
Host propertyThe host its ports are mapped on.
ContainerId propertyThe Docker container's ID.
GetMappedPortThe host port port is mapped to.
WithEnvSets an environment variable.
WithEnvSets environment variables.
WithCommandRuns commandParts in place of the image's command.
WithExposedPortsExposes ports on the Docker host, each on a free port.
WithNetworkJoins network (created when the first container on it starts).
WithNetworkAliasesAdds names it's reached by on Network.
DependsOnStarts startables before it.
WithExtraHostAdds an /etc/hosts entry.
WithReuseKeeps the container for later runs, when reuse is switched on as Testcontainers for Java has it (testcontainers.reuse.enable=true in ~/.testcontainers.properties, or TESTCONTAINERS_REUSE_ENABLE=true); otherwise it's removed after the run.
WithCopyFileToContainerCopies a host file or folder into the container before it starts.
WithStartupTimeoutHow long to wait for it to be ready.
StartAsync
StopAsync
DisposeAsyncStops it.
GetLogsAsyncIts log, so far.

RestPort

static
const int RestPort

The Admin Server's REST port.

NetworkAlias

static
const string NetworkAlias

Its name on the network.

Tm1AdminServerContainer

constructor
Tm1AdminServerContainer(Tm1Source source)

An Admin Server from source, in the image TM1 runs in.

Tm1AdminServerContainer

constructor
Tm1AdminServerContainer(string image, Tm1Source source)

An Admin Server from source, in image.

Source

property
Tm1Source Source

Where TM1 comes from.

RestUrl

property
string RestUrl

The Admin Server's REST root, http://host:port/api/v1/.

DockerImageName

property
string DockerImageName

The image it runs.

EnvMap

property
IReadOnlyDictionary<string, string> EnvMap

Its environment variables, so far.

CommandParts

property
IReadOnlyList<string> CommandParts

The command it runs, if not the image's.

ExposedPorts

property
IReadOnlyList<int> ExposedPorts

The ports it exposes on the Docker host.

Network

property
Network? Network

The network it joins, or null for Docker's default bridge.

NetworkAliases

property
IReadOnlyList<string> NetworkAliases

Its names on Network.

Dependencies

property
IReadOnlyCollection<IStartable> Dependencies

What starts before it.

Container

property
IContainer Container

The started container.

Throws

InvalidOperationException
It isn't started.

IsRunning

property
bool IsRunning

Host

property
string Host

The host its ports are mapped on.

ContainerId

property
string ContainerId

The Docker container's ID.

GetMappedPort

int GetMappedPort(int port)

The host port port is mapped to.

WithEnv

TSelf WithEnv(string name, string value)

Sets an environment variable.

WithEnv

TSelf WithEnv(IReadOnlyDictionary<string, string> variables)

Sets environment variables.

WithCommand

TSelf WithCommand(params string[] commandParts)

Runs commandParts in place of the image's command.

WithExposedPorts

TSelf WithExposedPorts(params int[] exposedPorts)

Exposes ports on the Docker host, each on a free port.

WithNetwork

TSelf WithNetwork(Network? network)

Joins network (created when the first container on it starts).

WithNetworkAliases

TSelf WithNetworkAliases(params string[] networkAliases)

Adds names it's reached by on Network.

DependsOn

TSelf DependsOn(params IStartable[] startables)

Starts startables before it.

WithExtraHost

TSelf WithExtraHost(string host, string ipAddress)

Adds an /etc/hosts entry.

WithReuse

TSelf WithReuse(bool reusable)

Keeps the container for later runs, when reuse is switched on as Testcontainers for Java has it (testcontainers.reuse.enable=true in ~/.testcontainers.properties, or TESTCONTAINERS_REUSE_ENABLE=true); otherwise it's removed after the run.

WithCopyFileToContainer

TSelf WithCopyFileToContainer(string hostPath, string containerPath)

Copies a host file or folder into the container before it starts.

WithStartupTimeout

TSelf WithStartupTimeout(TimeSpan timeout)

How long to wait for it to be ready.

StartAsync

Task StartAsync(CancellationToken cancellationToken = default)

StopAsync

Task StopAsync(CancellationToken cancellationToken = default)

DisposeAsync

ValueTask DisposeAsync()

Stops it.

GetLogsAsync

Task<string> GetLogsAsync(CancellationToken cancellationToken = default)

Its log, so far.