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 static | The image TM1 Web runs in, without its tag. |
WebImage static | The setting that replaces DefaultImage. |
HttpPort static | TM1 Web's HTTP port. |
Tm1WebContainer constructor | TM1 Web from source, in the image for it. |
Tm1WebContainer constructor | TM1 Web from source, in image. |
SharedAsync static | The one TM1 Web the tests of a run share, wired to the shared TM1 server, with reuse. |
WithTm1Server | 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 | Lists the servers of a shared Admin Server, on its network. |
AdminServer property | The shared Admin Server, or null. |
Source property | Where TM1 Web comes from. |
Tm1Server property | The TM1 server whose Admin Server it lists, or null. |
Url property | TM1 Web's address on the Docker host, http://host:port/tm1web/. |
AdminHost property | The Admin Server host TM1 Web lists servers from, as a TM1 Web login names it. |
DockerImageName property | The image it runs. |
EnvMap property | Its environment variables, so far. |
CommandParts property | The command it runs, if not the image's. |
ExposedPorts property | The ports it exposes on the Docker host. |
Network property | The network it joins, or null for Docker's default bridge. |
NetworkAliases property | Its names on Network. |
Dependencies property | What starts before it. |
Container property | The started container. |
IsRunning property | |
Host property | The host its ports are mapped on. |
ContainerId property | The Docker container's ID. |
GetMappedPort | The host port port is mapped to. |
WithEnv | Sets an environment variable. |
WithEnv | Sets environment variables. |
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 Network. |
DependsOn | Starts startables before it. |
WithExtraHost | Adds an /etc/hosts entry. |
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. |
WithCopyFileToContainer | Copies a host file or folder into the container before it starts. |
WithStartupTimeout | How long to wait for it to be ready. |
StartAsync | |
StopAsync | |
DisposeAsync | Stops it. |
GetLogsAsync | Its log, so far. |
DefaultImage
staticconst string DefaultImageThe image TM1 Web runs in, without its tag.
WebImage
staticconst string WebImageThe setting that replaces DefaultImage.
HttpPort
staticconst int HttpPortTM1 Web's HTTP port.
Tm1WebContainer
constructorTm1WebContainer(Tm1WebSource source)TM1 Web from source, in the image for it.
Tm1WebContainer
constructorTm1WebContainer(string image, Tm1WebSource source)TM1 Web from source, in image.
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
propertyTm1AdminServerContainer? AdminServerThe shared Admin Server, or null.
Source
propertyTm1WebSource SourceWhere TM1 Web comes from.
Tm1Server
propertyTm1ServerContainer? Tm1ServerThe TM1 server whose Admin Server it lists, or null.
Url
propertystring UrlTM1 Web's address on the Docker host, http://host:port/tm1web/.
AdminHost
propertystring AdminHostThe Admin Server host TM1 Web lists servers from, as a TM1 Web login names it.
Throws
InvalidOperationException- There's none yet.
DockerImageName
propertystring DockerImageNameThe image it runs.
EnvMap
propertyIReadOnlyDictionary<string, string> EnvMapIts environment variables, so far.
CommandParts
propertyIReadOnlyList<string> CommandPartsThe command it runs, if not the image's.
ExposedPorts
propertyIReadOnlyList<int> ExposedPortsThe ports it exposes on the Docker host.
Network
propertyNetwork? NetworkThe network it joins, or null for Docker's default bridge.
NetworkAliases
propertyIReadOnlyList<string> NetworkAliasesIts names on Network.
Dependencies
propertyIReadOnlyCollection<IStartable> DependenciesWhat starts before it.
Container
propertyIContainer ContainerThe started container.
Throws
InvalidOperationException- It isn't started.
IsRunning
propertybool IsRunningHost
propertystring HostThe host its ports are mapped on.
ContainerId
propertystring ContainerIdThe 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.