class

Testcontainers::MariadbContainer

Inherits Testcontainers::DockerContainer < Reference < Object

MariadbContainer provides a pre-configured container for MariaDB.

Example:

container = Testcontainers::MariadbContainer.new
container.start

url = container.database_url
# => "mysql://test:test@localhost:32768/test"

container.stop
container.remove

Constants

MARIADB_DEFAULT_DATABASE = "test"
MARIADB_DEFAULT_IMAGE = "mariadb:latest"
MARIADB_DEFAULT_PASSWORD = "test"
MARIADB_DEFAULT_PORT = 3306
MARIADB_DEFAULT_ROOT_PASSWORD = "test"
MARIADB_DEFAULT_USERNAME = "test"

Constructors

new(image : String = MARIADB_DEFAULT_IMAGE, root_password : String = ENV.fetch("MARIADB_ROOT_PASSWORD", MARIADB_DEFAULT_ROOT_PASSWORD), username : String = ENV.fetch("MARIADB_USER", MARIADB_DEFAULT_USERNAME), password : String = ENV.fetch("MARIADB_PASSWORD", MARIADB_DEFAULT_PASSWORD), database : String = ENV.fetch("MARIADB_DATABASE", MARIADB_DEFAULT_DATABASE))
Source

Instance methods

database
Source
database_url(protocol : String = "mysql", username : String | Nil = nil, password : String | Nil = nil, database : String | Nil = nil, options : Hash(String, String) = Hash(String, String).new) : String
Source
password
Source
port
Source
root_password
Source
start

Starts the container.

This will:

  1. Pull the image if not present
  2. Create the container
  3. Start the container
  4. Execute the wait strategy (if any)

Returns self for method chaining.

Source
username
Source
with_database(database : String) : self
Source
with_password(password : String) : self
Source
with_root_password(root_password : String) : self
Source
with_username(username : String) : self
Source