Skip to content

Commit 9a2f926

Browse files
committed
Fix Dialyzer
1 parent 33a5201 commit 9a2f926

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

lib/container/minio_container.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ defmodule Testcontainers.MinioContainer do
8383
|> with_environment(:MINIO_ROOT_USER, config.username)
8484
|> with_environment(:MINIO_ROOT_PASSWORD, config.password)
8585
|> with_reuse(config.reuse)
86-
|> with_cmd(["server", "--console-address", ":#{MinioContainer.default_ui_port()}", "/data"])
86+
|> with_cmd([
87+
"server",
88+
"--console-address",
89+
":#{MinioContainer.default_ui_port()}",
90+
"/data"
91+
])
8792
|> with_waiting_strategy(
8893
LogWaitStrategy.new(~r/.*Status: 1 Online, 0 Offline..*/, config.wait_timeout)
8994
)

lib/docker/api.ex

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ defmodule Testcontainers.Docker.Api do
185185
@doc """
186186
Creates a Docker network.
187187
"""
188+
# Suppress Dialyzer warnings - runtime behavior may differ from generated specs
189+
@dialyzer {:nowarn_function, create_network: 3}
188190
def create_network(name, conn, opts \\ []) when is_binary(name) do
189191
driver = Keyword.get(opts, :driver, "bridge")
190192

@@ -201,36 +203,35 @@ defmodule Testcontainers.Docker.Api do
201203
{:ok, %DockerEngineAPI.Model.ErrorResponse{message: message}} ->
202204
{:error, {:failed_to_create_network, message}}
203205

204-
{:error, %Tesla.Env{status: 409}} ->
206+
{_, %Tesla.Env{status: 409}} ->
205207
{:ok, :already_exists}
206208

207-
{:error, %Tesla.Env{status: status}} ->
209+
{_, %Tesla.Env{status: status}} ->
208210
{:error, {:http_error, status}}
209-
210-
{:error, reason} ->
211-
{:error, reason}
212211
end
213212
end
214213

215214
@doc """
216215
Removes a Docker network.
217216
"""
217+
# Suppress Dialyzer warnings - runtime behavior may differ from generated specs
218+
@dialyzer {:nowarn_function, remove_network: 2}
218219
def remove_network(name, conn) when is_binary(name) do
219220
case Api.Network.network_delete(conn, name) do
220-
{:ok, %Tesla.Env{status: 204}} ->
221+
{:ok, nil} ->
222+
:ok
223+
224+
{_, %Tesla.Env{status: 204}} ->
221225
:ok
222226

223-
{:ok, %Tesla.Env{status: 404}} ->
227+
{_, %Tesla.Env{status: 404}} ->
224228
{:error, :network_not_found}
225229

226230
{:ok, %DockerEngineAPI.Model.ErrorResponse{message: message}} ->
227231
{:error, {:failed_to_remove_network, message}}
228232

229-
{:error, %Tesla.Env{status: status}} ->
233+
{_, %Tesla.Env{status: status}} ->
230234
{:error, {:http_error, status}}
231-
232-
{:error, reason} ->
233-
{:error, reason}
234235
end
235236
end
236237

@@ -417,8 +418,6 @@ defmodule Testcontainers.Docker.Api do
417418
end)
418419
end
419420

420-
defp get_ip_from_networks(_), do: nil
421-
422421
defp create_exec(container_id, command, conn) do
423422
data = %ExecConfig{Cmd: command}
424423

0 commit comments

Comments
 (0)