skipcheck

TM1 Testcontainers · Docs · Containers

Tm1WebContainer

import { Tm1WebContainer } from "@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 RequiresTm1Web, which starts one shared TM1 Web against the shared TM1 server.

await using tm1 = new Tm1ServerContainer(tm1Source).withSeed(Tm1Seed.SDATA);
await using web = new Tm1WebContainer(webSource).withTm1Server(tm1);
await web.start(); // starts tm1 first
return web.getUrl(); // 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

DEFAULT_IMAGE propertyThe tm1-web image, without a tag.
WEB_IMAGE propertyOverrides the tm1-web image (not used with Tm1WebSource.PrivateImage).
HTTP_PORT propertyTM1 Web's HTTP port inside the container.
Tm1WebContainer constructorTM1 Web from source, in the default image (or TM1_WEB_IMAGE).
Tm1WebContainer constructorTM1 Web from source, in image, which must be tm1-web or built on it.
Tm1WebContainer constructor
shared staticThe TM1 Web most tests share.
withTm1ServerLists the servers of tm1's own Admin Server.
withAdminServerLists the servers of a shared Admin Server (Tm1ServerContainer.withAdminServer), on a network the two share.
getAdminServerThe Admin Server set with withAdminServer, or undefined.
getSourceWhere TM1 Web comes from.
getTm1ServerThe TM1 server set with withTm1Server, or undefined.
getUrlTM1 Web's address as seen from the host, e.g.
getAdminHostThe Admin Server host TM1 Web lists servers from, as a TM1 Web login names it.
configure@internal
addressOn staticA started container's address on its Network, or on Docker's default bridge.
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.

DEFAULT_IMAGE

property
static DEFAULT_IMAGE

The tm1-web image, without a tag.

WEB_IMAGE

property
static WEB_IMAGE

Overrides the tm1-web image (not used with Tm1WebSource.PrivateImage).

HTTP_PORT

property
static HTTP_PORT

TM1 Web's HTTP port inside the container.

Tm1WebContainer

constructor
constructor(source: Tm1WebSource)

TM1 Web from source, in the default image (or TM1_WEB_IMAGE).

Tm1WebContainer

constructor
constructor(image: string, source: Tm1WebSource)

TM1 Web from source, in image, which must be tm1-web or built on it.

Tm1WebContainer

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

shared

static
static shared(): Promise<Tm1WebContainer>

The TM1 Web most tests share: one per test run, started on first use with the source Tm1WebSource.discover finds, listing Tm1ServerContainer.shared's server. Marked reusable, as the shared TM1 server.

Throws

IllegalStateException if no TM1 Web or TM1 source is configured

withTm1Server

withTm1Server(tm1: Tm1ServerContainer): this

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

withAdminServer

withAdminServer(admin: Tm1AdminServerContainer): this

Lists the servers of a shared Admin Server (Tm1ServerContainer.withAdminServer), on a network the two share.

getAdminServer

getAdminServer(): Tm1AdminServerContainer | undefined

The Admin Server set with withAdminServer, or undefined.

getSource

getSource(): Tm1WebSource

Where TM1 Web comes from.

getTm1Server

getTm1Server(): Tm1ServerContainer | undefined

The TM1 server set with withTm1Server, or undefined.

getUrl

getUrl(): string

TM1 Web's address as seen from the host, e.g. http://localhost:54321/tm1web/.

getAdminHost

getAdminHost(): string

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

Throws

IllegalStateException if there's none yet

configure

configure(): void

@internal

addressOn

static
static addressOn(container: GenericContainer, who: string): string

A started container's address on its Network, or on Docker's default bridge.

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.