Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Argonus committed Dec 19, 2023
1 parent c867323 commit 0a9a133
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ jobs:
otp: 25.3
- elixir: 1.13
otp: 24.3
- elixir: 1.12
otp: 23.3
- elixir: 1.11
otp: 22.3

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion lib/container/cassandra_container.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ defmodule Testcontainers.CassandraContainer do
|> with_environment(:CASSANDRA_DC, "datacenter1")
|> with_waiting_strategy(
LogWaitStrategy.new(
~r/Starting listening for CQL clients on \/0\.0\.0\.0:#{CassandraContainer.default_port()}.*/,
~r/Starting listening for CQL clients on \/0\.0\.0\.0:#{
CassandraContainer.default_port()
}.*/,
config.wait_timeout
)
)
Expand Down
8 changes: 6 additions & 2 deletions lib/container/kafka_container.ex
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ defmodule Testcontainers.KafkaContainer do
with_cmd(container, [
"sh",
"-c",
"while [ ! -f /#{start_file_path} ]; do echo 'ok' && sleep 0.1; done; sh /#{start_file_path};"
"while [ ! -f /#{start_file_path} ]; do echo 'ok' && sleep 0.1; done; sh /#{
start_file_path
};"
])
end

Expand Down Expand Up @@ -268,7 +270,9 @@ defmodule Testcontainers.KafkaContainer do
internal = "BROKER://$(hostname -i):#{config.broker_port}"

external =
"OUTSIDE://#{Testcontainers.get_host()}:#{Container.mapped_port(container, config.kafka_port)}"
"OUTSIDE://#{Testcontainers.get_host()}:#{
Container.mapped_port(container, config.kafka_port)
}"

"""
export KAFKA_ADVERTISED_LISTENERS=#{internal},#{external}
Expand Down
4 changes: 3 additions & 1 deletion lib/wait_strategy/command_wait_strategy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ defmodule Testcontainers.CommandWaitStrategy do

defp log_retry_message(container_id, exit_code, delay) do
Logger.log(
"Command execution in container #{container_id} failed with exit_code #{exit_code}, retrying in #{delay}ms."
"Command execution in container #{container_id} failed with exit_code #{exit_code}, retrying in #{
delay
}ms."
)
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/wait_strategy/log_wait_strategy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ defmodule Testcontainers.LogWaitStrategy do

defp log_retry_message(container_id, log_regex, delay) do
Logger.log(
"Logs in container #{container_id} didn't match regex #{inspect(log_regex)}, retrying in #{delay}ms."
"Logs in container #{container_id} didn't match regex #{inspect(log_regex)}, retrying in #{
delay
}ms."
)
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/wait_strategy/port_wait_strategy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ defmodule Testcontainers.PortWaitStrategy do

defp log_retry_message(wait_strategy, host_port) do
Logger.log(
"Port #{wait_strategy.port} (host port #{host_port}) not open on IP #{wait_strategy.ip}, retrying in #{wait_strategy.retry_delay}ms."
"Port #{wait_strategy.port} (host port #{host_port}) not open on IP #{wait_strategy.ip}, retrying in #{
wait_strategy.retry_delay
}ms."
)
end
end
Expand Down
12 changes: 6 additions & 6 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule TestcontainersElixir.MixProject do
version: @version,
description:
"Testcontainers is an Elixir library that supports ExUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.",
elixir: "~> 1.11",
elixir: "~> 1.13",
source_url: @source_url,
homepage_url: @source_url,
aliases: aliases(),
Expand Down Expand Up @@ -65,14 +65,14 @@ defmodule TestcontainersElixir.MixProject do
# docker api
{:ex_docker_engine_api, "~> 1.43"},
# ecto module
{:ecto_sql, "~> 3.10", optional: true},
{:ecto, "~> 3.10", optional: true},
{:ecto_sql, "~> 3.3", optional: true},
{:ecto, "~> 3.3", optional: true},
# mysql
{:myxql, "~> 0.6.0", only: [:dev, :test]},
{:myxql, "~> 0.4", only: [:dev, :test]},
# postgres
{:postgrex, "~> 0.17", only: [:dev, :test]},
{:postgrex, "~> 0.14", only: [:dev, :test]},
# redis
{:redix, "~> 1.2", only: [:dev, :test]},
{:redix, "~> 1.0", only: [:dev, :test]},
# ceph and minio
{:ex_aws, "~> 2.1", only: [:dev, :test]},
{:ex_aws_s3, "~> 2.0", only: [:dev, :test]},
Expand Down
42 changes: 15 additions & 27 deletions mix.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion test/ecto_mysql_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ defmodule Testcontainers.EctoMysqlTest do
end

test "fails properly when migrations doesnt pass successfully" do
assert {:error, %MyXQL.Error{message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stringa NOT NULL, `hashed_password` varchar(255) NOT NULL, `confirmed_at` dateti' at line 1"}} =
assert {:error,
%MyXQL.Error{
message:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stringa NOT NULL, `hashed_password` varchar(255) NOT NULL, `confirmed_at` dateti' at line 1"
}} =
mysql_container(
app: :testcontainers,
migrations_path: "#{__DIR__}/support/bad_migrations",
Expand Down

0 comments on commit 0a9a133

Please sign in to comment.