public class VaultContainer<SELF extends VaultContainer<SELF>>
extends org.testcontainers.containers.GenericContainer<SELF>
Supported image: hashicorp/vault, vault
Exposure ports: 8200
| Constructor and Description |
|---|
VaultContainer()
Deprecated.
use
VaultContainer(DockerImageName) instead |
VaultContainer(org.testcontainers.utility.DockerImageName dockerImageName) |
VaultContainer(java.lang.String dockerImageName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) |
java.lang.String |
getHttpHostAddress() |
SELF |
withInitCommand(java.lang.String... commands)
Run initialization commands using the vault cli.
|
SELF |
withLogLevel(VaultLogLevel level)
Deprecated.
use
GenericContainer.withEnv(String, String) instead |
SELF |
withSecretInVault(java.lang.String path,
java.lang.String firstSecret,
java.lang.String... remainingSecrets)
Deprecated.
use
withInitCommand(String...) instead |
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, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, 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, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setContainerDef, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCopyToContainer, 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, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning@Deprecated public VaultContainer()
VaultContainer(DockerImageName) insteadpublic VaultContainer(java.lang.String dockerImageName)
public VaultContainer(org.testcontainers.utility.DockerImageName dockerImageName)
public java.lang.String getHttpHostAddress()
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.@Deprecated public SELF withLogLevel(VaultLogLevel level)
GenericContainer.withEnv(String, String) insteadGenericContainer.withLogConsumer(Consumer).level - the logging level to set for Vault.@Deprecated public SELF withSecretInVault(java.lang.String path, java.lang.String firstSecret, java.lang.String... remainingSecrets)
withInitCommand(String...) instead
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 pathpublic SELF withInitCommand(java.lang.String... commands)
Useful for enabling more secret engines like:
.withInitCommand("secrets enable pki")
.withInitCommand("secrets enable transit")
commands - The commands to send to the vault cli