Skip to content

Commit

Permalink
unset ENV before running cli deploy integration tests (#2309)
Browse files Browse the repository at this point in the history
* unset ENV for cli deploy test

* ip4 first, please
  • Loading branch information
taylordowns2000 authored Jul 19, 2024
1 parent 9cd1405 commit 2b7a4b8
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions test/integration/cli_deploy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ defmodule Lightning.CliDeployTest do

@cli_path Application.app_dir(:lightning, "priv/openfn/bin/openfn")

@required_env [
{"OPENFN_ENDPOINT", nil},
{"OPENFN_API_KEY", nil},
{"NODE_OPTIONS", "--dns-result-order=ipv4first"}
]

@moduletag tmp_dir: true, integration: true

setup :set_mox_from_context
Expand Down Expand Up @@ -61,7 +67,8 @@ defmodule Lightning.CliDeployTest do
{logs, _exit_code} =
System.cmd(
@cli_path,
["pull", project.id, "-c", config_path]
["pull", project.id, "-c", config_path],
env: @required_env
)

assert logs =~ "Failed to authorize request with endpoint"
Expand All @@ -76,7 +83,8 @@ defmodule Lightning.CliDeployTest do
# Try to pull with a project user
System.cmd(
@cli_path,
["pull", project.id, "-c", config_path]
["pull", project.id, "-c", config_path],
env: @required_env
)

# Check result
Expand Down Expand Up @@ -114,7 +122,11 @@ defmodule Lightning.CliDeployTest do
user |> Ecto.Changeset.change(%{role: :user}) |> Lightning.Repo.update!()

{logs, _} =
System.cmd(@cli_path, ["deploy", "-c", config_path, "--no-confirm"])
System.cmd(
@cli_path,
["deploy", "-c", config_path, "--no-confirm"],
env: @required_env
)

assert logs =~ "Failed to authorize request with endpoint"
assert logs =~ "403 Forbidden"
Expand All @@ -127,7 +139,11 @@ defmodule Lightning.CliDeployTest do
|> Ecto.Changeset.change(%{role: :superuser})
|> Lightning.Repo.update!()

System.cmd(@cli_path, ["deploy", "-c", config_path, "--no-confirm"])
System.cmd(
@cli_path,
["deploy", "-c", config_path, "--no-confirm"],
env: @required_env
)

assert [project] =
Lightning.Repo.all(Lightning.Projects.Project)
Expand Down Expand Up @@ -207,7 +223,8 @@ defmodule Lightning.CliDeployTest do

System.cmd(
@cli_path,
["pull", project.id, "-c", config_path]
["pull", project.id, "-c", config_path],
env: @required_env
)

# Lets use the updated spec
Expand All @@ -225,7 +242,8 @@ defmodule Lightning.CliDeployTest do

System.cmd(
@cli_path,
["deploy", project.id, "-c", config_path, "--no-confirm"]
["deploy", project.id, "-c", config_path, "--no-confirm"],
env: @required_env
)

updated_project = Lightning.Repo.reload(project)
Expand Down

0 comments on commit 2b7a4b8

Please sign in to comment.