Packages

Gleam TestContainers wrapper around Elixir TestContainers

Current section

Files

Jump to
testcontainers_gleam src testcontainers_gleam@ceph.erl
Raw

src/testcontainers_gleam@ceph.erl

-module(testcontainers_gleam@ceph).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/testcontainers_gleam/ceph.gleam").
-export([new/0, with_image/2, with_access_key/2, with_secret_key/2, with_bucket/2, with_port/2, with_wait_timeout/2, with_check_image/2, with_reuse/2, build/1, default_image/0, port/1, connection_url/1]).
-export_type([ceph_config/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Ceph container configuration.\n"
"\n"
" Wraps `Testcontainers.CephContainer` to provide typed builders\n"
" for a Ceph container. Use `new` to create a default configuration,\n"
" customize with `with_*` functions, then `build` to get a `Container`.\n"
"\n"
" ## Example\n"
"\n"
" ```gleam\n"
" import testcontainers_gleam\n"
" import testcontainers_gleam/ceph\n"
"\n"
" let config = ceph.new()\n"
" let container = ceph.build(config)\n"
" let assert Ok(running) = testcontainers_gleam.start_container(container)\n"
" let url = ceph.connection_url(running)\n"
" ```\n"
).
-type ceph_config() :: any().
-file("src/testcontainers_gleam/ceph.gleam", 30).
?DOC(
" Create a new Ceph container configuration with defaults.\n"
"\n"
" Default image: `quay.io/ceph/demo:latest-quincy`, port: 8080,\n"
" timeout: 300s, access_key: `\"test\"`.\n"
).
-spec new() -> ceph_config().
new() ->
'Elixir.Testcontainers.CephContainer':new().
-file("src/testcontainers_gleam/ceph.gleam", 34).
?DOC(" Override the Docker image.\n").
-spec with_image(ceph_config(), binary()) -> ceph_config().
with_image(Config, Image) ->
'Elixir.Testcontainers.CephContainer':with_image(Config, Image).
-file("src/testcontainers_gleam/ceph.gleam", 38).
?DOC(" Override the access key (default `\"test\"`).\n").
-spec with_access_key(ceph_config(), binary()) -> ceph_config().
with_access_key(Config, Access_key) ->
'Elixir.Testcontainers.CephContainer':with_access_key(Config, Access_key).
-file("src/testcontainers_gleam/ceph.gleam", 42).
?DOC(" Override the secret key.\n").
-spec with_secret_key(ceph_config(), binary()) -> ceph_config().
with_secret_key(Config, Secret_key) ->
'Elixir.Testcontainers.CephContainer':with_secret_key(Config, Secret_key).
-file("src/testcontainers_gleam/ceph.gleam", 46).
?DOC(" Set the bucket name.\n").
-spec with_bucket(ceph_config(), binary()) -> ceph_config().
with_bucket(Config, Bucket) ->
'Elixir.Testcontainers.CephContainer':with_bucket(Config, Bucket).
-file("src/testcontainers_gleam/ceph.gleam", 50).
?DOC(" Override the exposed port (default 8080).\n").
-spec with_port(ceph_config(), integer()) -> ceph_config().
with_port(Config, Port) ->
'Elixir.Testcontainers.CephContainer':with_port(Config, Port).
-file("src/testcontainers_gleam/ceph.gleam", 54).
?DOC(" Override the wait timeout in milliseconds (default 300000).\n").
-spec with_wait_timeout(ceph_config(), integer()) -> ceph_config().
with_wait_timeout(Config, Timeout) ->
'Elixir.Testcontainers.CephContainer':with_wait_timeout(Config, Timeout).
-file("src/testcontainers_gleam/ceph.gleam", 58).
?DOC(" Set the regex pattern to validate the image name.\n").
-spec with_check_image(ceph_config(), binary()) -> ceph_config().
with_check_image(Config, Pattern) ->
'Elixir.Testcontainers.CephContainer':with_check_image(Config, Pattern).
-file("src/testcontainers_gleam/ceph.gleam", 62).
?DOC(" Enable or disable container reuse across test runs.\n").
-spec with_reuse(ceph_config(), boolean()) -> ceph_config().
with_reuse(Config, Reuse) ->
'Elixir.Testcontainers.CephContainer':with_reuse(Config, Reuse).
-file("src/testcontainers_gleam/ceph.gleam", 65).
?DOC(" Build a `Container` from this Ceph configuration.\n").
-spec build(ceph_config()) -> testcontainers_gleam@container:container().
build(Config) ->
testcontainers_gleam_ffi:build_container(Config).
-file("src/testcontainers_gleam/ceph.gleam", 71).
?DOC(" Get the default Docker image name (without tag).\n").
-spec default_image() -> binary().
default_image() ->
'Elixir.Testcontainers.CephContainer':default_image().
-file("src/testcontainers_gleam/ceph.gleam", 75).
?DOC(" Get the host-mapped port for the Ceph container.\n").
-spec port(testcontainers_gleam@container:container()) -> integer().
port(Container) ->
'Elixir.Testcontainers.CephContainer':port(Container).
-file("src/testcontainers_gleam/ceph.gleam", 79).
?DOC(" Get the Ceph connection URL (e.g. `\"http://localhost:32768/\"`).\n").
-spec connection_url(testcontainers_gleam@container:container()) -> binary().
connection_url(Container) ->
'Elixir.Testcontainers.CephContainer':connection_url(Container).