From 0c898a2b8d13a3e73598387e1e07f3b69561cc8d Mon Sep 17 00:00:00 2001 From: Ian Woodard <17186604+IanWoodard@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:38:23 -0600 Subject: [PATCH 1/2] fix(up): Always pull new images on up --- devservices/commands/up.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devservices/commands/up.py b/devservices/commands/up.py index e7cc803..e7f383f 100644 --- a/devservices/commands/up.py +++ b/devservices/commands/up.py @@ -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( From 641c075ef9344eca96c9f657974c70c56d7bc964 Mon Sep 17 00:00:00 2001 From: Ian Woodard <17186604+IanWoodard@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:48:01 -0600 Subject: [PATCH 2/2] Cleaning up tests --- tests/commands/test_up.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/commands/test_up.py b/tests/commands/test_up.py index abbf6f0..a86b429 100644 --- a/tests/commands/test_up.py +++ b/tests/commands/test_up.py @@ -90,6 +90,8 @@ def test_up_simple( "clickhouse", "redis", "-d", + "--pull", + "always", ], check=True, capture_output=True, @@ -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 ( @@ -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() @@ -288,6 +308,8 @@ def test_up_mode_simple( "up", "redis", "-d", + "--pull", + "always", ], check=True, capture_output=True, @@ -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() @@ -426,6 +450,8 @@ def test_up_mutliple_modes( "up", "redis", "-d", + "--pull", + "always", ], check=True, capture_output=True, @@ -553,6 +579,8 @@ def test_up_multiple_modes_overlapping_running_service( "up", "clickhouse", "-d", + "--pull", + "always", ], mock.ANY, ),