Skip to content

Commit

Permalink
fix(up): Always pull new images (#187)
Browse files Browse the repository at this point in the history
* fix(up): Always pull new images on up

* Cleaning up tests
  • Loading branch information
IanWoodard authored Dec 23, 2024
1 parent 20a253f commit de68458
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
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

0 comments on commit de68458

Please sign in to comment.