skipcheck

TM1 Testcontainers · Docs · Containers

Tm1AdminServerContainer

import { Tm1AdminServerContainer } from "@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 admin = new Tm1AdminServerContainer(tm1Source);
await using planning = new Tm1ServerContainer(tm1Source).withEnv("TM1_SERVER_NAME", "planning").withAdminServer(admin);
await using reporting = new Tm1ServerContainer(tm1Source).withEnv("TM1_SERVER_NAME", "reporting").withAdminServer(admin);
await planning.start();
await reporting.start();
return admin.getRestUrl() + "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

REST_PORT propertyThe Admin Server's REST port.
NETWORK_ALIAS propertyIts name on the network, which the servers registering with it are given.
Tm1AdminServerContainer constructorAn Admin Server from source, in the image TM1 runs in.
Tm1AdminServerContainer constructorAn Admin Server from source, in image.
Tm1AdminServerContainer constructor
getSourceWhere TM1 comes from.
getRestUrlThe Admin Server's REST root as seen from the host, http://host:port/api/v1/.
getDockerImageNameThe image it runs.
getEnvMapIts environment variables, so far.
getCommandPartsThe command it runs, if not the image's.
getExposedPortsThe ports it exposes on the Docker host.
getNetworkThe network it joins, or undefined for Docker's default bridge.
getNetworkAliasesIts names on getNetwork.
getDependenciesWhat starts before it.
getLabelsThe labels set with withLabel.
isShouldBeReusedWhether it asks to be kept for later runs (withReuse).
getCopiedFilesThe files and folders copied in with withCopyFileToContainer.
getBindsThe bind mounts, source:target[:ro], the source a host folder or a volume.
getContainerThe started container.
isRunning
getHostThe host its ports are mapped on.
getContainerIdThe Docker container's ID.
getMappedPortThe host port port is mapped to.
withEnvSets an environment variable, or several.
withEnvSets several environment variables at once.
withEnv
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 getNetwork.
dependsOnStarts startables before it.
withExtraHostAdds an /etc/hosts entry.
withHostnameSets the container's host name.
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.
withLabelAdds a Docker label.
withCopyFileToContainerCopies a host file or folder into the container before it starts.
withStartupTimeoutHow long to wait for it to be ready, in milliseconds.
start
stop
[Symbol.asyncDispose]Stops it, for await using.
getLogsIts log, so far.
configureFinishes the configuration as it starts, once what it depends on is running; the tests call it to check the wiring.

REST_PORT

property
static REST_PORT

The Admin Server's REST port.

NETWORK_ALIAS

property
static NETWORK_ALIAS

Its name on the network, which the servers registering with it are given.

Tm1AdminServerContainer

constructor
constructor(source: Tm1Source)

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

Tm1AdminServerContainer

constructor
constructor(image: string, source: Tm1Source)

An Admin Server from source, in image.

Tm1AdminServerContainer

constructor
constructor(imageOrSource: string | Tm1Source, maybeSource?: Tm1Source)

getSource

getSource(): Tm1Source

Where TM1 comes from.

getRestUrl

getRestUrl(): string

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

getDockerImageName

getDockerImageName(): string

The image it runs.

getEnvMap

getEnvMap(): ReadonlyMap<string, string>

Its environment variables, so far.

getCommandParts

getCommandParts(): readonly string[]

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

getExposedPorts

getExposedPorts(): readonly number[]

The ports it exposes on the Docker host.

getNetwork

getNetwork(): Network | undefined

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

getNetworkAliases

getNetworkAliases(): readonly string[]

Its names on getNetwork.

getDependencies

getDependencies(): readonly Startable[]

What starts before it.

getLabels

getLabels(): ReadonlyMap<string, string>

The labels set with withLabel.

isShouldBeReused

isShouldBeReused(): boolean

Whether it asks to be kept for later runs (withReuse).

getCopiedFiles

getCopiedFiles(): ReadonlyMap<string, string>

The files and folders copied in with withCopyFileToContainer: the path in the container to the path on the host.

getBinds

getBinds(): string[]

The bind mounts, source:target[:ro], the source a host folder or a volume.

getContainer

getContainer(): StartedTestContainer

The started container.

Throws

IllegalStateException if it isn't started

isRunning

isRunning(): boolean

getHost

getHost(): string

The host its ports are mapped on.

getContainerId

getContainerId(): string

The Docker container's ID.

getMappedPort

getMappedPort(port: number): number

The host port port is mapped to.

withEnv

withEnv(name: string, value: string): this

Sets an environment variable, or several.

withEnv

withEnv(variables: Readonly<Record<string, string>> | ReadonlyMap<string, string>): this

Sets several environment variables at once.

withEnv

withEnv(name: string | Readonly<Record<string, string>> | ReadonlyMap<string, string>, value?: string): this

withCommand

withCommand(...commandParts: string[]): this

Runs commandParts in place of the image's command.

withExposedPorts

withExposedPorts(...ports: number[]): this

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

withNetwork

withNetwork(network: Network | undefined): this

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

withNetworkAliases

withNetworkAliases(...aliases: string[]): this

Adds names it's reached by on getNetwork.

dependsOn

dependsOn(...startables: Startable[]): this

Starts startables before it.

withExtraHost

withExtraHost(host: string, ipAddress: string): this

Adds an /etc/hosts entry.

withHostname

withHostname(hostname: string): this

Sets the container's host name.

withReuse

withReuse(reusable: boolean): this

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.

withLabel

withLabel(key: string, value: string): this

Adds a Docker label.

withCopyFileToContainer

withCopyFileToContainer(hostPath: string, containerPath: string): this

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

withStartupTimeout

withStartupTimeout(timeout: number): this

How long to wait for it to be ready, in milliseconds.

start

start(): Promise<void>

stop

stop(): Promise<void>

[Symbol.asyncDispose]

[Symbol.asyncDispose](): Promise<void>

Stops it, for await using: the same as stop.

getLogs

getLogs(): Promise<string>

Its log, so far.

configure

configure(): void

Finishes the configuration as it starts, once what it depends on is running; the tests call it to check the wiring.