Skip to content

Commit

Permalink
remove all remaining dialyzer warnings <3
Browse files Browse the repository at this point in the history
  • Loading branch information
jarlah committed Nov 5, 2024
1 parent 840901f commit 76352ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
16 changes: 7 additions & 9 deletions lib/container.ex
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,13 @@ defmodule Testcontainers.Container do
@doc """
Sets a network mode to apply to the container object in docker.
"""
@dialyzer {:nowarn_function, with_network_mode: 2}
def with_network_mode(%__MODULE__{} = config, mode)
when is_binary(mode) and not is_os(:linux) do
with mode <- String.downcase(mode) do
if mode == "host" do
Testcontainers.Logger.log(
"To use host network mode on non-linux hosts, please see https://docs.docker.com/network/drivers/host"
)
end
def with_network_mode(%__MODULE__{} = config, mode) when is_binary(mode) do
mode = String.downcase(mode)

if mode == "host" and not is_os(:linux) do
Testcontainers.Logger.log(
"To use host network mode on non-linux hosts, please see https://docs.docker.com/network/drivers/host"
)
end

%__MODULE__{config | network_mode: mode}
Expand Down
3 changes: 2 additions & 1 deletion lib/docker/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ defmodule Testcontainers.Docker.Api do

def put_file(container_id, connection, path, file_name, file_contents) do
with {:ok, tar_file_contents} <- create_tar_stream(file_name, file_contents),
{:ok, %Tesla.Env{}} <- Api.Container.put_container_archive(connection, container_id, path, tar_file_contents) do
{:ok, %Tesla.Env{}} <-
Api.Container.put_container_archive(connection, container_id, path, tar_file_contents) do
:ok
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/testcontainers/test.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule Mix.Tasks.Testcontainers.Test do
end)
end

@dialyzer {:no_return, run_tests_and_exit: 1}
@spec run_tests_and_exit(String.t()) :: no_return()
defp run_tests_and_exit(database) do
{container, env} = setup_container(database)
exit_code = run_tests(env)
Expand Down

0 comments on commit 76352ab

Please sign in to comment.