devservices 1.1.4__tar.gz → 1.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devservices-1.1.4 → devservices-1.1.5}/PKG-INFO +1 -1
- {devservices-1.1.4 → devservices-1.1.5}/README.md +1 -1
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/down.py +1 -1
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/purge.py +3 -1
- devservices-1.1.5/devservices/commands/reset.py +115 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/toggle.py +13 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/up.py +19 -18
- {devservices-1.1.4 → devservices-1.1.5}/devservices/main.py +2 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/docker.py +9 -7
- {devservices-1.1.4 → devservices-1.1.5}/devservices.egg-info/PKG-INFO +1 -1
- {devservices-1.1.4 → devservices-1.1.5}/devservices.egg-info/SOURCES.txt +2 -0
- {devservices-1.1.4 → devservices-1.1.5}/pyproject.toml +1 -1
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_purge.py +7 -7
- devservices-1.1.5/tests/commands/test_reset.py +531 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_toggle.py +19 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_up.py +41 -15
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_docker.py +9 -9
- {devservices-1.1.4 → devservices-1.1.5}/LICENSE.md +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/__init__.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/__init__.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/list_dependencies.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/list_services.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/logs.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/serve.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/status.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/commands/update.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/configs/service_config.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/constants.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/exceptions.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/__init__.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/check_for_update.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/console.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/dependencies.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/devenv.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/docker_compose.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/file_lock.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/git.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/install_binary.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/services.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/state.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices/utils/supervisor.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices.egg-info/dependency_links.txt +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices.egg-info/entry_points.txt +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices.egg-info/requires.txt +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/devservices.egg-info/top_level.txt +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/setup.cfg +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/testing/__init__.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/testing/utils.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/__init__.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_down.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_list_dependencies.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_list_services.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_logs.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_serve.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_status.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/commands/test_update.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/configs/test_service_config.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/conftest.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_check_for_update.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_dependencies.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_docker_compose.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_git.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_install_binary.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_services.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_state.py +0 -0
- {devservices-1.1.4 → devservices-1.1.5}/tests/utils/test_supervisor.py +0 -0
|
@@ -31,7 +31,7 @@ NOTE: service-name is an optional parameter. If not provided, devservices will a
|
|
|
31
31
|
The recommended way to install devservices is through a virtualenv in the requirements.txt. Once that is installed and a devservices config file is added, you should be able to run `devservices up` to begin local development.
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
devservices==1.1.
|
|
34
|
+
devservices==1.1.5
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### 2. Add devservices config files
|
|
@@ -83,7 +83,7 @@ def down(args: Namespace) -> None:
|
|
|
83
83
|
exit(1)
|
|
84
84
|
|
|
85
85
|
modes = service.config.modes
|
|
86
|
-
exclude_local = args
|
|
86
|
+
exclude_local = getattr(args, "exclude_local", False)
|
|
87
87
|
|
|
88
88
|
state = State()
|
|
89
89
|
starting_services = set(state.get_service_entries(StateTables.STARTING_SERVICES))
|
|
@@ -40,7 +40,9 @@ def purge(_args: Namespace) -> None:
|
|
|
40
40
|
state.clear_state()
|
|
41
41
|
|
|
42
42
|
try:
|
|
43
|
-
devservices_containers = get_matching_containers(
|
|
43
|
+
devservices_containers = get_matching_containers(
|
|
44
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
45
|
+
)
|
|
44
46
|
except DockerDaemonNotRunningError as e:
|
|
45
47
|
console.warning(str(e))
|
|
46
48
|
return
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from argparse import _SubParsersAction
|
|
4
|
+
from argparse import ArgumentParser
|
|
5
|
+
from argparse import Namespace
|
|
6
|
+
|
|
7
|
+
from sentry_sdk import capture_exception
|
|
8
|
+
|
|
9
|
+
from devservices.commands.down import down
|
|
10
|
+
from devservices.constants import DEVSERVICES_ORCHESTRATOR_LABEL
|
|
11
|
+
from devservices.exceptions import DockerDaemonNotRunningError
|
|
12
|
+
from devservices.exceptions import DockerError
|
|
13
|
+
from devservices.utils.console import Console
|
|
14
|
+
from devservices.utils.console import Status
|
|
15
|
+
from devservices.utils.dependencies import construct_dependency_graph
|
|
16
|
+
from devservices.utils.dependencies import DependencyNode
|
|
17
|
+
from devservices.utils.dependencies import DependencyType
|
|
18
|
+
from devservices.utils.docker import get_matching_containers
|
|
19
|
+
from devservices.utils.docker import get_volumes_for_containers
|
|
20
|
+
from devservices.utils.docker import remove_docker_resources
|
|
21
|
+
from devservices.utils.docker import stop_containers
|
|
22
|
+
from devservices.utils.services import find_matching_service
|
|
23
|
+
from devservices.utils.state import State
|
|
24
|
+
from devservices.utils.state import StateTables
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def add_parser(subparsers: _SubParsersAction[ArgumentParser]) -> None:
|
|
28
|
+
parser = subparsers.add_parser("reset", help="Reset a service's volumes")
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"service_name",
|
|
31
|
+
help="Name of the service to reset volumes for",
|
|
32
|
+
nargs="?",
|
|
33
|
+
default=None,
|
|
34
|
+
)
|
|
35
|
+
parser.set_defaults(func=reset)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def reset(args: Namespace) -> None:
|
|
39
|
+
"""Reset a specified service's volumes."""
|
|
40
|
+
console = Console()
|
|
41
|
+
service_name = args.service_name
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
matching_containers = get_matching_containers(
|
|
45
|
+
[
|
|
46
|
+
DEVSERVICES_ORCHESTRATOR_LABEL,
|
|
47
|
+
f"com.docker.compose.service={args.service_name}",
|
|
48
|
+
]
|
|
49
|
+
)
|
|
50
|
+
except DockerDaemonNotRunningError as e:
|
|
51
|
+
console.warning(str(e))
|
|
52
|
+
return
|
|
53
|
+
except DockerError as e:
|
|
54
|
+
console.failure(f"Failed to get matching containers {e.stderr}")
|
|
55
|
+
exit(1)
|
|
56
|
+
|
|
57
|
+
if len(matching_containers) == 0:
|
|
58
|
+
console.failure(f"No containers found for {service_name}")
|
|
59
|
+
exit(1)
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
matching_volumes = get_volumes_for_containers(matching_containers)
|
|
63
|
+
except DockerError as e:
|
|
64
|
+
console.failure(f"Failed to get matching volumes {e.stderr}")
|
|
65
|
+
exit(1)
|
|
66
|
+
|
|
67
|
+
if len(matching_volumes) == 0:
|
|
68
|
+
console.failure(f"No volumes found for {service_name}")
|
|
69
|
+
exit(1)
|
|
70
|
+
|
|
71
|
+
state = State()
|
|
72
|
+
started_services = set(state.get_service_entries(StateTables.STARTED_SERVICES))
|
|
73
|
+
starting_services = set(state.get_service_entries(StateTables.STARTING_SERVICES))
|
|
74
|
+
active_service_names = starting_services.union(started_services)
|
|
75
|
+
|
|
76
|
+
# TODO: We should add threading here to speed up the process
|
|
77
|
+
for active_service_name in active_service_names:
|
|
78
|
+
active_service = find_matching_service(active_service_name)
|
|
79
|
+
starting_active_modes = state.get_active_modes_for_service(
|
|
80
|
+
active_service_name, StateTables.STARTING_SERVICES
|
|
81
|
+
)
|
|
82
|
+
started_active_modes = state.get_active_modes_for_service(
|
|
83
|
+
active_service_name, StateTables.STARTED_SERVICES
|
|
84
|
+
)
|
|
85
|
+
active_modes = starting_active_modes or started_active_modes
|
|
86
|
+
dependency_graph = construct_dependency_graph(active_service, active_modes)
|
|
87
|
+
if (
|
|
88
|
+
DependencyNode(name=service_name, dependency_type=DependencyType.COMPOSE)
|
|
89
|
+
in dependency_graph.graph
|
|
90
|
+
):
|
|
91
|
+
console.warning(
|
|
92
|
+
f"Bringing down {active_service_name} in order to safely reset {service_name}"
|
|
93
|
+
)
|
|
94
|
+
down(Namespace(service_name=active_service_name, exclude_local=True))
|
|
95
|
+
|
|
96
|
+
with Status(
|
|
97
|
+
lambda: console.warning(f"Resetting docker volumes for {service_name}"),
|
|
98
|
+
lambda: console.success(f"Docker volumes have been reset for {service_name}"),
|
|
99
|
+
):
|
|
100
|
+
try:
|
|
101
|
+
stop_containers(matching_containers, should_remove=True)
|
|
102
|
+
except DockerError as e:
|
|
103
|
+
console.failure(
|
|
104
|
+
f"Failed to stop and remove {', '.join(matching_containers)}\nError: {e.stderr}"
|
|
105
|
+
)
|
|
106
|
+
capture_exception(e)
|
|
107
|
+
exit(1)
|
|
108
|
+
try:
|
|
109
|
+
remove_docker_resources("volume", list(matching_volumes))
|
|
110
|
+
except DockerError as e:
|
|
111
|
+
console.failure(
|
|
112
|
+
f"Failed to remove volumes {', '.join(matching_volumes)}\nError: {e.stderr}"
|
|
113
|
+
)
|
|
114
|
+
capture_exception(e)
|
|
115
|
+
exit(1)
|
|
@@ -138,6 +138,18 @@ def handle_transition_to_local_runtime(service_to_transition: Service) -> None:
|
|
|
138
138
|
service_to_transition,
|
|
139
139
|
[service_to_transition_dependency_config.remote.mode],
|
|
140
140
|
)
|
|
141
|
+
console.warning(f"Restarting {service_to_transition.name} in default mode")
|
|
142
|
+
# This behavior matches the default behavior of up as it
|
|
143
|
+
# will bring up dependencies with local runtimes automatically
|
|
144
|
+
# in the default mode. If the user wants to run it in a different
|
|
145
|
+
# mode, they can switch to that mode manually.
|
|
146
|
+
up(
|
|
147
|
+
Namespace(
|
|
148
|
+
service_name=service_to_transition.name,
|
|
149
|
+
mode="default",
|
|
150
|
+
exclude_local=False,
|
|
151
|
+
)
|
|
152
|
+
)
|
|
141
153
|
break
|
|
142
154
|
state.update_service_runtime(service_to_transition.name, ServiceRuntime.LOCAL)
|
|
143
155
|
|
|
@@ -206,6 +218,7 @@ def restart_dependent_services(
|
|
|
206
218
|
service_name=dependent_service,
|
|
207
219
|
mode=mode,
|
|
208
220
|
debug=False,
|
|
221
|
+
exclude_local=True,
|
|
209
222
|
)
|
|
210
223
|
try:
|
|
211
224
|
up(args)
|
|
@@ -87,6 +87,7 @@ def up(args: Namespace, existing_status: Status | None = None) -> None:
|
|
|
87
87
|
|
|
88
88
|
modes = service.config.modes
|
|
89
89
|
mode = args.mode
|
|
90
|
+
exclude_local = getattr(args, "exclude_local", False)
|
|
90
91
|
|
|
91
92
|
state = State()
|
|
92
93
|
|
|
@@ -101,15 +102,15 @@ def up(args: Namespace, existing_status: Status | None = None) -> None:
|
|
|
101
102
|
services_with_local_runtime = state.get_services_by_runtime(
|
|
102
103
|
ServiceRuntime.LOCAL
|
|
103
104
|
)
|
|
104
|
-
|
|
105
|
+
local_runtime_dependency_names = set()
|
|
105
106
|
for service_with_local_runtime in services_with_local_runtime:
|
|
106
107
|
if (
|
|
107
108
|
mode in modes
|
|
108
109
|
and service_with_local_runtime != service.name
|
|
109
110
|
and service_with_local_runtime in modes[mode]
|
|
110
111
|
):
|
|
111
|
-
|
|
112
|
-
if
|
|
112
|
+
local_runtime_dependency_names.add(service_with_local_runtime)
|
|
113
|
+
if exclude_local:
|
|
113
114
|
status.warning(
|
|
114
115
|
f"Skipping '{service_with_local_runtime}' as it is set to run locally"
|
|
115
116
|
)
|
|
@@ -139,10 +140,10 @@ def up(args: Namespace, existing_status: Status | None = None) -> None:
|
|
|
139
140
|
if (
|
|
140
141
|
service_with_local_runtime
|
|
141
142
|
in [dep.service_name for dep in remote_dependencies]
|
|
142
|
-
and service_with_local_runtime not in
|
|
143
|
+
and service_with_local_runtime not in local_runtime_dependency_names
|
|
143
144
|
):
|
|
144
|
-
|
|
145
|
-
if
|
|
145
|
+
local_runtime_dependency_names.add(service_with_local_runtime)
|
|
146
|
+
if exclude_local:
|
|
146
147
|
status.warning(
|
|
147
148
|
f"Skipping '{service_with_local_runtime}' as it is set to run locally"
|
|
148
149
|
)
|
|
@@ -155,19 +156,19 @@ def up(args: Namespace, existing_status: Status | None = None) -> None:
|
|
|
155
156
|
for dep in remote_dependencies
|
|
156
157
|
if dep.service_name not in services_with_local_runtime
|
|
157
158
|
}
|
|
159
|
+
if not exclude_local and len(local_runtime_dependency_names) > 0:
|
|
160
|
+
status.warning("Starting dependencies with local runtimes...")
|
|
161
|
+
for local_runtime_dependency_name in local_runtime_dependency_names:
|
|
162
|
+
up(
|
|
163
|
+
Namespace(
|
|
164
|
+
service_name=local_runtime_dependency_name,
|
|
165
|
+
mode=mode,
|
|
166
|
+
exclude_local=True,
|
|
167
|
+
),
|
|
168
|
+
status,
|
|
169
|
+
)
|
|
170
|
+
status.warning(f"Continuing with service '{service.name}'")
|
|
158
171
|
try:
|
|
159
|
-
if not args.exclude_local:
|
|
160
|
-
status.warning("Starting dependencies with local runtimes...")
|
|
161
|
-
for skipped_service in skipped_services:
|
|
162
|
-
up(
|
|
163
|
-
Namespace(
|
|
164
|
-
service_name=skipped_service,
|
|
165
|
-
mode=mode,
|
|
166
|
-
exclude_local=True,
|
|
167
|
-
),
|
|
168
|
-
status,
|
|
169
|
-
)
|
|
170
|
-
status.warning(f"Continuing with service '{service.name}'")
|
|
171
172
|
_up(service, [mode], remote_dependencies, mode_dependencies, status)
|
|
172
173
|
except DockerComposeError as dce:
|
|
173
174
|
capture_exception(dce, level="info")
|
|
@@ -24,6 +24,7 @@ from devservices.commands import list_dependencies
|
|
|
24
24
|
from devservices.commands import list_services
|
|
25
25
|
from devservices.commands import logs
|
|
26
26
|
from devservices.commands import purge
|
|
27
|
+
from devservices.commands import reset
|
|
27
28
|
from devservices.commands import serve
|
|
28
29
|
from devservices.commands import status
|
|
29
30
|
from devservices.commands import toggle
|
|
@@ -150,6 +151,7 @@ def main() -> None:
|
|
|
150
151
|
purge.add_parser(subparsers)
|
|
151
152
|
serve.add_parser(subparsers)
|
|
152
153
|
toggle.add_parser(subparsers)
|
|
154
|
+
reset.add_parser(subparsers)
|
|
153
155
|
|
|
154
156
|
args = parser.parse_args()
|
|
155
157
|
|
|
@@ -88,11 +88,14 @@ def wait_for_healthy(container: ContainerNames, status: Status) -> None:
|
|
|
88
88
|
raise ContainerHealthcheckFailedError(container.short_name, HEALTHCHECK_TIMEOUT)
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
def get_matching_containers(
|
|
91
|
+
def get_matching_containers(labels: list[str]) -> list[str]:
|
|
92
92
|
"""
|
|
93
93
|
Returns a list of container names with the given label
|
|
94
94
|
"""
|
|
95
95
|
check_docker_daemon_running()
|
|
96
|
+
filters = []
|
|
97
|
+
for label in labels:
|
|
98
|
+
filters.extend(["--filter", f"label={label}"])
|
|
96
99
|
try:
|
|
97
100
|
return (
|
|
98
101
|
subprocess.check_output(
|
|
@@ -101,9 +104,8 @@ def get_matching_containers(label: str) -> list[str]:
|
|
|
101
104
|
"ps",
|
|
102
105
|
"-a",
|
|
103
106
|
"-q",
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
],
|
|
107
|
+
]
|
|
108
|
+
+ filters,
|
|
107
109
|
text=True,
|
|
108
110
|
stderr=subprocess.DEVNULL,
|
|
109
111
|
)
|
|
@@ -112,7 +114,7 @@ def get_matching_containers(label: str) -> list[str]:
|
|
|
112
114
|
)
|
|
113
115
|
except subprocess.CalledProcessError as e:
|
|
114
116
|
raise DockerError(
|
|
115
|
-
command=f"docker ps -q
|
|
117
|
+
command=f"docker ps -a -q {' '.join(filters)}",
|
|
116
118
|
returncode=e.returncode,
|
|
117
119
|
stdout=e.stdout,
|
|
118
120
|
stderr=e.stderr,
|
|
@@ -196,7 +198,7 @@ def stop_containers(containers: list[str], should_remove: bool = False) -> None:
|
|
|
196
198
|
["docker", "stop"] + containers,
|
|
197
199
|
check=True,
|
|
198
200
|
stdout=subprocess.DEVNULL,
|
|
199
|
-
stderr=subprocess.
|
|
201
|
+
stderr=subprocess.PIPE,
|
|
200
202
|
)
|
|
201
203
|
except subprocess.CalledProcessError as e:
|
|
202
204
|
raise DockerError(
|
|
@@ -218,7 +220,7 @@ def remove_docker_resources(resource_type: str, resources: list[str]) -> None:
|
|
|
218
220
|
["docker", resource_type, "rm", *resources],
|
|
219
221
|
check=True,
|
|
220
222
|
stdout=subprocess.DEVNULL,
|
|
221
|
-
stderr=subprocess.
|
|
223
|
+
stderr=subprocess.PIPE,
|
|
222
224
|
)
|
|
223
225
|
except subprocess.CalledProcessError as e:
|
|
224
226
|
raise DockerError(
|
|
@@ -18,6 +18,7 @@ devservices/commands/list_dependencies.py
|
|
|
18
18
|
devservices/commands/list_services.py
|
|
19
19
|
devservices/commands/logs.py
|
|
20
20
|
devservices/commands/purge.py
|
|
21
|
+
devservices/commands/reset.py
|
|
21
22
|
devservices/commands/serve.py
|
|
22
23
|
devservices/commands/status.py
|
|
23
24
|
devservices/commands/toggle.py
|
|
@@ -46,6 +47,7 @@ tests/commands/test_list_dependencies.py
|
|
|
46
47
|
tests/commands/test_list_services.py
|
|
47
48
|
tests/commands/test_logs.py
|
|
48
49
|
tests/commands/test_purge.py
|
|
50
|
+
tests/commands/test_reset.py
|
|
49
51
|
tests/commands/test_serve.py
|
|
50
52
|
tests/commands/test_status.py
|
|
51
53
|
tests/commands/test_toggle.py
|
|
@@ -58,7 +58,7 @@ def test_purge_docker_daemon_not_running(
|
|
|
58
58
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
59
59
|
|
|
60
60
|
mock_get_matching_containers.assert_called_once_with(
|
|
61
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
61
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
62
62
|
)
|
|
63
63
|
mock_get_volumes_for_containers.assert_not_called()
|
|
64
64
|
mock_stop_containers.assert_not_called()
|
|
@@ -117,7 +117,7 @@ def test_purge_docker_error_get_matching_containers(
|
|
|
117
117
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
118
118
|
|
|
119
119
|
mock_get_matching_containers.assert_called_once_with(
|
|
120
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
120
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
121
121
|
)
|
|
122
122
|
mock_get_volumes_for_containers.assert_not_called()
|
|
123
123
|
mock_stop_containers.assert_not_called()
|
|
@@ -174,7 +174,7 @@ def test_purge_docker_error_get_volumes_for_containers(
|
|
|
174
174
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
175
175
|
|
|
176
176
|
mock_get_matching_containers.assert_called_once_with(
|
|
177
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
177
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
178
178
|
)
|
|
179
179
|
mock_get_volumes_for_containers.assert_called_once_with(["abc", "def", "ghi"])
|
|
180
180
|
mock_stop_containers.assert_not_called()
|
|
@@ -234,7 +234,7 @@ def test_purge_docker_error_get_matching_networks(
|
|
|
234
234
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
235
235
|
|
|
236
236
|
mock_get_matching_containers.assert_called_once_with(
|
|
237
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
237
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
238
238
|
)
|
|
239
239
|
mock_get_volumes_for_containers.assert_called_once_with(["abc", "def", "ghi"])
|
|
240
240
|
mock_stop_containers.assert_called_once_with(
|
|
@@ -293,7 +293,7 @@ def test_purge_docker_error_stop_containers(
|
|
|
293
293
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
294
294
|
|
|
295
295
|
mock_get_matching_containers.assert_called_once_with(
|
|
296
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
296
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
297
297
|
)
|
|
298
298
|
mock_get_volumes_for_containers.assert_called_once_with(["abc", "def", "ghi"])
|
|
299
299
|
mock_stop_containers.assert_called_once_with(
|
|
@@ -355,7 +355,7 @@ def test_purge_docker_error_remove_volumes_continues_to_remove_networks(
|
|
|
355
355
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
356
356
|
|
|
357
357
|
mock_get_matching_containers.assert_called_once_with(
|
|
358
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
358
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
359
359
|
)
|
|
360
360
|
mock_get_volumes_for_containers.assert_called_once_with(["abc", "def", "ghi"])
|
|
361
361
|
mock_stop_containers.assert_called_once_with(
|
|
@@ -425,7 +425,7 @@ def test_purge_docker_error_remove_networks(
|
|
|
425
425
|
assert state.get_service_entries(StateTables.STARTED_SERVICES) == []
|
|
426
426
|
|
|
427
427
|
mock_get_matching_containers.assert_called_once_with(
|
|
428
|
-
DEVSERVICES_ORCHESTRATOR_LABEL
|
|
428
|
+
[DEVSERVICES_ORCHESTRATOR_LABEL]
|
|
429
429
|
)
|
|
430
430
|
mock_get_volumes_for_containers.assert_called_once_with(["abc", "def", "ghi"])
|
|
431
431
|
mock_stop_containers.assert_called_once_with(
|