Tm1AdminServerContainer
using 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 var admin = new Tm1AdminServerContainer(tm1Source);
await using var planning = new Tm1ServerContainer(tm1Source).WithEnv("TM1_SERVER_NAME", "planning").WithAdminServer(admin);
await using var reporting = new Tm1ServerContainer(tm1Source).WithEnv("TM1_SERVER_NAME", "reporting").WithAdminServer(admin);
await planning.StartAsync();
await reporting.StartAsync();
return admin.RestUrl + "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
RestPort static | The Admin Server's REST port. |
NetworkAlias static | Its name on the network. |
Tm1AdminServerContainer constructor | An Admin Server from source, in the image TM1 runs in. |
Tm1AdminServerContainer constructor | An Admin Server from source, in image. |
Source property | Where TM1 comes from. |
RestUrl property | The Admin Server's REST root, http://host:port/api/v1/. |
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. |
RestPort
staticconst int RestPortThe Admin Server's REST port.
NetworkAlias
staticconst string NetworkAliasIts name on the network.
Tm1AdminServerContainer
constructorTm1AdminServerContainer(Tm1Source source)An Admin Server from source, in the image TM1 runs in.
Tm1AdminServerContainer
constructorTm1AdminServerContainer(string image, Tm1Source source)An Admin Server from source, in image.
Source
propertyTm1Source SourceWhere TM1 comes from.
RestUrl
propertystring RestUrlThe Admin Server's REST root, http://host:port/api/v1/.
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.