Class InfluxDBContainer<SELF extends InfluxDBContainer<SELF>>

java.lang.Object
org.testcontainers.containers.GenericContainer<SELF>
org.testcontainers.containers.InfluxDBContainer<SELF>
All Implemented Interfaces:
AutoCloseable, org.testcontainers.containers.Container<SELF>, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable

public class InfluxDBContainer<SELF extends InfluxDBContainer<SELF>> extends org.testcontainers.containers.GenericContainer<SELF>
Testcontainers implementation for InfluxDB.

Supported image: influxdb

Exposed ports: 8086

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.testcontainers.containers.Container

    org.testcontainers.containers.Container.ExecResult
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Integer
     
    static final String
    Deprecated.

    Fields inherited from class org.testcontainers.containers.GenericContainer

    CONTAINER_RUNNING_TIMEOUT_SEC, dependencies, dockerClient, INTERNAL_HOST_HOSTNAME, waitStrategy

    Fields inherited from interface org.testcontainers.containers.ContainerState

    STATE_HEALTHY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Deprecated.
    InfluxDBContainer(org.testcontainers.utility.DockerImageName dockerImageName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Sets the InfluxDB environment variables based on the version
     
    Properties of InfluxDB 2.x
     
     
    org.influxdb.InfluxDB
    Deprecated.
     
     
     
     
     
    Sets the admin user
    withAdminPassword(String adminPassword)
    Sets the admin password
    withAdminToken(String adminToken)
    Sets the admin token
    withAuthEnabled(boolean authEnabled)
    Determines if authentication should be enabled or not
    Initializes bucket with given name
    withDatabase(String database)
    Initializes database with given name
    withOrganization(String organization)
    Sets the organization name
    withPassword(String password)
    Set password for InfluxDB
    withRetention(String retention)
    Sets the retention in days
    withUsername(String username)
    Set user for InfluxDB

    Methods inherited from class org.testcontainers.containers.GenericContainer

    addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, containerIsCreated, containerIsStarted, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, 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, stop, 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, withWorkingDirectory

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.testcontainers.containers.Container

    addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBind

    Methods inherited from interface org.testcontainers.containers.ContainerState

    copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning

    Methods inherited from interface org.testcontainers.lifecycle.Startable

    close
  • Field Details

  • Constructor Details

  • Method Details

    • configure

      protected void configure()
      Sets the InfluxDB environment variables based on the version
      Overrides:
      configure in class org.testcontainers.containers.GenericContainer<SELF extends InfluxDBContainer<SELF>>
    • getLivenessCheckPortNumbers

      public Set<Integer> getLivenessCheckPortNumbers()
      Specified by:
      getLivenessCheckPortNumbers in interface org.testcontainers.containers.wait.strategy.WaitStrategyTarget
      Overrides:
      getLivenessCheckPortNumbers in class org.testcontainers.containers.GenericContainer<SELF extends InfluxDBContainer<SELF>>
    • withUsername

      public InfluxDBContainer<SELF> withUsername(String username)
      Set user for InfluxDB
      Parameters:
      username - The username to set for the system's initial super-user
      Returns:
      a reference to this container instance
    • withPassword

      public InfluxDBContainer<SELF> withPassword(String password)
      Set password for InfluxDB
      Parameters:
      password - The password to set for the system's initial super-user
      Returns:
      a reference to this container instance
    • withAuthEnabled

      public InfluxDBContainer<SELF> withAuthEnabled(boolean authEnabled)
      Determines if authentication should be enabled or not
      Parameters:
      authEnabled - Enables authentication.
      Returns:
      a reference to this container instance
    • withAdmin

      public InfluxDBContainer<SELF> withAdmin(String admin)
      Sets the admin user
      Parameters:
      admin - The name of the admin user to be created. If this is unset, no admin user is created.
      Returns:
      a reference to this container instance
    • withAdminPassword

      public InfluxDBContainer<SELF> withAdminPassword(String adminPassword)
      Sets the admin password
      Parameters:
      adminPassword - The password for the admin user. If this is unset, a random password is generated and printed to standard out.
      Returns:
      a reference to this container instance
    • withDatabase

      public InfluxDBContainer<SELF> withDatabase(String database)
      Initializes database with given name
      Parameters:
      database - name of the database.
      Returns:
      a reference to this container instance
    • withOrganization

      public InfluxDBContainer<SELF> withOrganization(String organization)
      Sets the organization name
      Parameters:
      organization - The organization for the initial setup of influxDB.
      Returns:
      a reference to this container instance
    • withBucket

      public InfluxDBContainer<SELF> withBucket(String bucket)
      Initializes bucket with given name
      Parameters:
      bucket - name of the bucket.
      Returns:
      a reference to this container instance
    • withRetention

      public InfluxDBContainer<SELF> withRetention(String retention)
      Sets the retention in days
      Parameters:
      retention - days bucket will retain data (0 is infinite, default is 0).
      Returns:
      a reference to this container instance
    • withAdminToken

      public InfluxDBContainer<SELF> withAdminToken(String adminToken)
      Sets the admin token
      Parameters:
      adminToken - Authentication token to associate with the admin user.
      Returns:
      a reference to this container instance
    • getUrl

      public String getUrl()
      Returns:
      a url to InfluxDB
    • getNewInfluxDB

      @Deprecated public org.influxdb.InfluxDB getNewInfluxDB()
      Deprecated.
      Returns:
      a InfluxDB client for InfluxDB 1.x.
    • getUsername

      public String getUsername()
    • getPassword

      public String getPassword()
    • getDatabase

      public String getDatabase()
    • getBucket

      public String getBucket()
      Properties of InfluxDB 2.x
    • getOrganization

      public String getOrganization()
    • getRetention

      public Optional<String> getRetention()
    • getAdminToken

      public Optional<String> getAdminToken()