skipcheck

TM1 Testcontainers · Docs · Containers

Tm1WebContainer

using Skipcheck.Tm1.Testcontainers;

TM1 Web (IBM Planning Analytics Spreadsheet Services) in Docker, for tests, built on the tm1-web image.

TM1 Web lists and logs on to the TM1 servers registered with an Admin Server, so it's started against a Tm1ServerContainer with WithTm1Server. That container's embedded Admin Server is the one TM1 Web uses. Most tests use RequiresTm1WebFactAttribute, which starts one shared TM1 Web against the shared TM1 server.

await using var tm1 = new Tm1ServerContainer(tm1Source).WithSeed(Tm1Seed.Sdata);
await using var web = new Tm1WebContainer(webSource).WithTm1Server(tm1);
await web.StartAsync(); // starts tm1 first
return web.Url; // http://localhost:54321/tm1web/

The image contains no IBM software, so every container needs a Tm1WebSource. TM1 Web's default heap here is 1 GB; set the image's TM1_WEB_HEAP with WithEnv to change it.

Members

DefaultImage staticThe image TM1 Web runs in, without its tag.
WebImage staticThe setting that replaces DefaultImage.
HttpPort staticTM1 Web's HTTP port.
Tm1WebContainer constructorTM1 Web from source, in the image for it.
Tm1WebContainer constructorTM1 Web from source, in image.
SharedAsync staticThe one TM1 Web the tests of a run share, wired to the shared TM1 server, with reuse.
WithTm1ServerLists the servers of tm1's own Admin Server; TM1 starts first, and gets a network if it has none and isn't running.
WithAdminServerLists the servers of a shared Admin Server, on its network.
AdminServer propertyThe shared Admin Server, or null.
Source propertyWhere TM1 Web comes from.
Tm1Server propertyThe TM1 server whose Admin Server it lists, or null.
Url propertyTM1 Web's address on the Docker host, http://host:port/tm1web/.
AdminHost propertyThe Admin Server host TM1 Web lists servers from, as a TM1 Web login names it.
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.

DefaultImage

static
const string DefaultImage

The image TM1 Web runs in, without its tag.

WebImage

static
const string WebImage

The setting that replaces DefaultImage.

HttpPort

static
const int HttpPort

TM1 Web's HTTP port.

Tm1WebContainer

constructor
Tm1WebContainer(Tm1WebSource source)

TM1 Web from source, in the image for it.

Tm1WebContainer

constructor
Tm1WebContainer(string image, Tm1WebSource source)

TM1 Web from source, in image.

SharedAsync

static
Task<Tm1WebContainer> SharedAsync(CancellationToken cancellationToken = default)

The one TM1 Web the tests of a run share, wired to the shared TM1 server, with reuse.

Throws

InvalidOperationException
No TM1 Web source is configured.

WithTm1Server

Tm1WebContainer WithTm1Server(Tm1ServerContainer tm1)

Lists the servers of tm1's own Admin Server; TM1 starts first, and gets a network if it has none and isn't running.

WithAdminServer

Tm1WebContainer WithAdminServer(Tm1AdminServerContainer admin)

Lists the servers of a shared Admin Server, on its network.

AdminServer

property
Tm1AdminServerContainer? AdminServer

The shared Admin Server, or null.

Source

property
Tm1WebSource Source

Where TM1 Web comes from.

Tm1Server

property
Tm1ServerContainer? Tm1Server

The TM1 server whose Admin Server it lists, or null.

Url

property
string Url

TM1 Web's address on the Docker host, http://host:port/tm1web/.

AdminHost

property
string AdminHost

The Admin Server host TM1 Web lists servers from, as a TM1 Web login names it.

Throws

InvalidOperationException
There's none yet.

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.