A library implementing the Divo Stack behaviour, providing a pre-configured moto server via docker-compose for integration testing Elixir apps. The cluster is a multi-service moto compose stack that can be configured with all or specific services.
Requires inclusion of the Divo library in your mix project.
The package can be installed by adding divo
and divo_moto
to your list of dependencies in mix.exs
:
def deps do
[
{:divo, "~> 1.1"},
{:divo_moto, "~> 0.1.1"}
]
end
In your Mix environment exs file (i.e. config/integration.exs), include the following:
config :myapp,
divo: [
{DivoMoto, [port: 5000, service: :all, aws_access_key_id: "access_key_id", aws_secret_access_key: "secret_key" ]}
]
In your integration test specify that you want to use Divo:
use Divo
...
The resulting stack will create a multi-service moto server exposing port 5000 to the host.
You may omit the configuration arguments to DivoMoto and still have a working stack.
-
port
: An integer that tells moto what port to listen on. Defaults to5000
-
service
: An atom representing the service (or all of them) you would like moto to serve for you. See moto for a full list of services (the names for each section are the service name/atom). Defaults to:all
. -
aws_access_key_id
: A string representing the access key id that moto will use to restrict access to its local API. Defaults to"server_key"
. -
aws_secret_access_key
: A string representing the secret key that moto will use to restrict access to its local API. Defaults to"server_secret"
. -
moto_image_version
: A string representing the moto image (bennyhat/moto-server) version to use. A list of available versions can be found on their dockerhub tags page. Defaults to"latest"
.
See Divo GitHub or Divo Hex Documentation for more instructions on using and configuring the Divo library. See bennyhat/moto-server for further documentation on using and configuring the features of this image.
Below is an example configuration file that configures Divo
and DivoMoto
to stand up a multi-service moto server and then configures ExAws to point to it.
use Mix.Config
access_key_id = "server_key"
secret_access_key = "server_secret"
port = 5000
config :alb_ingress, divo: [
{DivoMoto,
[
port: port,
service: :all,
aws_access_key_id: access_key_id,
aws_secret_access_key: secret_access_key
]
}
]
config :ex_aws,
debug_requests: true,
access_key_id: access_key_id,
secret_access_key: secret_access_key,
ec2: [
scheme: "http://",
host: "localhost",
port: port
],
elasticloadbalancing: [
scheme: "http://",
host: "localhost",
port: port
]
Released under Apache 2 license.