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 property | The tm1-web image, without a tag. |
WEB_IMAGE property | Overrides the tm1-web image (not used with Tm1WebSource.PrivateImage). |
HTTP_PORT property | TM1 Web's HTTP port inside the container. |
Tm1WebContainer constructor | TM1 Web from source, in the default image (or TM1_WEB_IMAGE). |
Tm1WebContainer constructor | TM1 Web from source, in image, which must be tm1-web or built on it. |
Tm1WebContainer constructor | |
shared static | The TM1 Web most tests share. |
withTm1Server | Lists the servers of tm1's own Admin Server. |
withAdminServer | Lists the servers of a shared Admin Server (Tm1ServerContainer.withAdminServer), on a network the two share. |
getAdminServer | The Admin Server set with withAdminServer, or undefined. |
getSource | Where TM1 Web comes from. |
getTm1Server | The TM1 server set with withTm1Server, or undefined. |
getUrl | TM1 Web's address as seen from the host, e.g. |
getAdminHost | The Admin Server host TM1 Web lists servers from, as a TM1 Web login names it. |
configure | @internal |
addressOn static | A started container's address on its Network, or on Docker's default bridge. |
getDockerImageName | The image it runs. |
getEnvMap | Its environment variables, so far. |
getCommandParts | The command it runs, if not the image's. |
getExposedPorts | The ports it exposes on the Docker host. |
getNetwork | The network it joins, or undefined for Docker's default bridge. |
getNetworkAliases | Its names on getNetwork. |
getDependencies | What starts before it. |
getLabels | The labels set with withLabel. |
isShouldBeReused | Whether it asks to be kept for later runs (withReuse). |
getCopiedFiles | The files and folders copied in with withCopyFileToContainer. |
getBinds | The bind mounts, source:target[:ro], the source a host folder or a volume. |
getContainer | The started container. |
isRunning | |
getHost | The host its ports are mapped on. |
getContainerId | The Docker container's ID. |
getMappedPort | The host port port is mapped to. |
withEnv | Sets an environment variable, or several. |
withEnv | Sets several environment variables at once. |
withEnv | |
withCommand | Runs commandParts in place of the image's command. |
withExposedPorts | Exposes ports on the Docker host, each on a free port. |
withNetwork | Joins network (created when the first container on it starts). |
withNetworkAliases | Adds names it's reached by on getNetwork. |
dependsOn | Starts startables before it. |
withExtraHost | Adds an /etc/hosts entry. |
withHostname | Sets the container's host name. |
withReuse | 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 | Adds a Docker label. |
withCopyFileToContainer | Copies a host file or folder into the container before it starts. |
withStartupTimeout | How long to wait for it to be ready, in milliseconds. |
start | |
stop | |
[Symbol.asyncDispose] | Stops it, for await using. |
getLogs | Its log, so far. |
DEFAULT_IMAGE
propertystatic DEFAULT_IMAGEThe tm1-web image, without a tag.
WEB_IMAGE
propertystatic WEB_IMAGEOverrides the tm1-web image (not used with Tm1WebSource.PrivateImage).
HTTP_PORT
propertystatic HTTP_PORTTM1 Web's HTTP port inside the container.
Tm1WebContainer
constructorconstructor(source: Tm1WebSource)TM1 Web from source, in the default image (or TM1_WEB_IMAGE).
Tm1WebContainer
constructorconstructor(image: string, source: Tm1WebSource)TM1 Web from source, in image, which must be tm1-web or built on it.
Tm1WebContainer
constructorconstructor(imageOrSource: string | Tm1WebSource, maybeSource?: Tm1WebSource)withTm1Server
withTm1Server(tm1: Tm1ServerContainer): thisLists 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): thisLists the servers of a shared Admin Server (Tm1ServerContainer.withAdminServer), on a network the two share.
getAdminServer
getAdminServer(): Tm1AdminServerContainer | undefinedThe Admin Server set with withAdminServer, or undefined.
getSource
getSource(): Tm1WebSourceWhere TM1 Web comes from.
getTm1Server
getTm1Server(): Tm1ServerContainer | undefinedThe TM1 server set with withTm1Server, or undefined.
getUrl
getUrl(): stringTM1 Web's address as seen from the host, e.g. http://localhost:54321/tm1web/.
getAdminHost
getAdminHost(): stringThe 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
staticstatic addressOn(container: GenericContainer, who: string): stringA started container's address on its Network, or on Docker's default bridge.
getDockerImageName
getDockerImageName(): stringThe 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 | undefinedThe 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(): booleanWhether 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(): StartedTestContainerThe started container.
Throws
- IllegalStateException if it isn't started
isRunning
isRunning(): booleangetHost
getHost(): stringThe host its ports are mapped on.
getContainerId
getContainerId(): stringThe Docker container's ID.
getMappedPort
getMappedPort(port: number): numberThe host port port is mapped to.
withEnv
withEnv(name: string, value: string): thisSets an environment variable, or several.
withEnv
withEnv(variables: Readonly<Record<string, string>> | ReadonlyMap<string, string>): thisSets several environment variables at once.
withEnv
withEnv(name: string | Readonly<Record<string, string>> | ReadonlyMap<string, string>, value?: string): thiswithCommand
withCommand(...commandParts: string[]): thisRuns commandParts in place of the image's command.
withExposedPorts
withExposedPorts(...ports: number[]): thisExposes ports on the Docker host, each on a free port.
withNetwork
withNetwork(network: Network | undefined): thisJoins network (created when the first container on it starts).
withNetworkAliases
withNetworkAliases(...aliases: string[]): thisAdds names it's reached by on getNetwork.
dependsOn
dependsOn(...startables: Startable[]): thisStarts startables before it.
withExtraHost
withExtraHost(host: string, ipAddress: string): thisAdds an /etc/hosts entry.
withHostname
withHostname(hostname: string): thisSets the container's host name.
withReuse
withReuse(reusable: boolean): thisKeeps 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): thisAdds a Docker label.
withCopyFileToContainer
withCopyFileToContainer(hostPath: string, containerPath: string): thisCopies a host file or folder into the container before it starts.
withStartupTimeout
withStartupTimeout(timeout: number): thisHow 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.