Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(up): Always pull new images #187

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion devservices/commands/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _up(
current_env[
DEVSERVICES_DEPENDENCIES_CACHE_DIR_KEY
] = relative_local_dependency_directory
options = ["-d"]
options = ["-d", "--pull", "always"]
dependency_graph = construct_dependency_graph(service, modes=modes)
starting_order = dependency_graph.get_starting_order()
sorted_remote_dependencies = sorted(
Expand Down
28 changes: 28 additions & 0 deletions tests/commands/test_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def test_up_simple(
"clickhouse",
"redis",
"-d",
"--pull",
"always",
],
check=True,
capture_output=True,
Expand Down Expand Up @@ -155,6 +157,8 @@ def test_up_dependency_error(

mock_update_started_service.assert_not_called()

mock_run.assert_not_called()

captured = capsys.readouterr()
assert "Retrieving dependencies" not in captured.out.strip()
assert (
Expand Down Expand Up @@ -214,6 +218,22 @@ def test_up_error(

mock_update_started_service.assert_not_called()

mock_run.assert_called_with(
[
"docker",
"compose",
"-f",
f"{tmp_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}",
"config",
"--services",
],
stdout=subprocess.PIPE,
timeout=None,
check=True,
text=True,
env=mock.ANY,
)

captured = capsys.readouterr()
assert "Retrieving dependencies" not in captured.out.strip()
assert "Starting 'example-service' in mode: 'default'" not in captured.out.strip()
Expand Down Expand Up @@ -288,6 +308,8 @@ def test_up_mode_simple(
"up",
"redis",
"-d",
"--pull",
"always",
],
check=True,
capture_output=True,
Expand Down Expand Up @@ -358,6 +380,8 @@ def test_up_mode_does_not_exist(

mock_update_started_service.assert_not_called()

mock_run.assert_not_called()

captured = capsys.readouterr()
assert "Retrieving dependencies" not in captured.out.strip()
assert "Starting 'example-service' in mode: 'test'" not in captured.out.strip()
Expand Down Expand Up @@ -426,6 +450,8 @@ def test_up_mutliple_modes(
"up",
"redis",
"-d",
"--pull",
"always",
],
check=True,
capture_output=True,
Expand Down Expand Up @@ -553,6 +579,8 @@ def test_up_multiple_modes_overlapping_running_service(
"up",
"clickhouse",
"-d",
"--pull",
"always",
],
mock.ANY,
),
Expand Down
Loading