public class VaultContainer<SELF extends VaultContainer<SELF>>
extends org.testcontainers.containers.GenericContainer<SELF>
Other helpful features include the withVaultPort, and withVaultToken methods for convenience.
| Constructor and Description |
|---|
VaultContainer() |
VaultContainer(java.lang.String dockerImageName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) |
SELF |
withSecretInVault(java.lang.String path,
java.lang.String firstSecret,
java.lang.String... remainingSecrets)
Pre-loads secrets into Vault container.
|
SELF |
withVaultPort(int port)
Deprecated.
the exposed port will be randomized automatically. As calling this method provides no additional value, you are recommended to remove the call. getFirstMappedPort() may be used to obtain the listening vault port.
|
SELF |
withVaultToken(java.lang.String token)
Sets the Vault root token for the container so application tests can source secrets using the token
|
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, configure, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, fetchDockerDaemonInfo, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerDaemonInfo, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindcopyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningpublic VaultContainer()
public VaultContainer(java.lang.String dockerImageName)
protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
containerIsStarted in class org.testcontainers.containers.GenericContainer<SELF extends VaultContainer<SELF>>public SELF withVaultToken(java.lang.String token)
token - the root token value to set for Vault.@Deprecated public SELF withVaultPort(int port)
port - the port number you want to have the Vault container listen on for tests.public SELF withSecretInVault(java.lang.String path, java.lang.String firstSecret, java.lang.String... remainingSecrets)
The secrets are added to vault directly after the container is up via the
addSecrets, called from containerIsStarted
path - specific Vault path to store specified secretsfirstSecret - first secret to add to specifed pathremainingSecrets - var args list of secrets to add to specified path