stoobly-agent 1.9.12__py3-none-any.whl → 1.10.1__py3-none-any.whl
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.
- stoobly_agent/__init__.py +1 -1
- stoobly_agent/app/api/__init__.py +4 -20
- stoobly_agent/app/api/application_http_request_handler.py +5 -2
- stoobly_agent/app/api/configs_controller.py +3 -3
- stoobly_agent/app/cli/decorators/exec.py +1 -1
- stoobly_agent/app/cli/helpers/handle_config_update_service.py +4 -0
- stoobly_agent/app/cli/intercept_cli.py +40 -7
- stoobly_agent/app/cli/scaffold/app_command.py +4 -0
- stoobly_agent/app/cli/scaffold/app_config.py +21 -3
- stoobly_agent/app/cli/scaffold/app_create_command.py +109 -2
- stoobly_agent/app/cli/scaffold/constants.py +14 -3
- stoobly_agent/app/cli/scaffold/docker/constants.py +4 -6
- stoobly_agent/app/cli/scaffold/docker/service/build_decorator.py +2 -2
- stoobly_agent/app/cli/scaffold/docker/service/builder.py +36 -10
- stoobly_agent/app/cli/scaffold/docker/workflow/builder.py +0 -27
- stoobly_agent/app/cli/scaffold/docker/workflow/command_decorator.py +25 -0
- stoobly_agent/app/cli/scaffold/docker/workflow/decorators_factory.py +7 -2
- stoobly_agent/app/cli/scaffold/docker/workflow/detached_decorator.py +42 -0
- stoobly_agent/app/cli/scaffold/docker/workflow/local_decorator.py +26 -0
- stoobly_agent/app/cli/scaffold/docker/workflow/mock_decorator.py +9 -10
- stoobly_agent/app/cli/scaffold/docker/workflow/reverse_proxy_decorator.py +5 -8
- stoobly_agent/app/cli/scaffold/service_config.py +133 -34
- stoobly_agent/app/cli/scaffold/service_create_command.py +11 -2
- stoobly_agent/app/cli/scaffold/service_dependency.py +51 -0
- stoobly_agent/app/cli/scaffold/service_docker_compose.py +3 -3
- stoobly_agent/app/cli/scaffold/service_workflow_validate_command.py +10 -7
- stoobly_agent/app/cli/scaffold/templates/app/.Dockerfile.context +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/build/.docker-compose.base.yml +2 -2
- stoobly_agent/app/cli/scaffold/templates/app/build/mock/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/build/mock/docker-compose.yml +16 -6
- stoobly_agent/app/cli/scaffold/templates/app/build/record/bin/configure +26 -1
- stoobly_agent/app/cli/scaffold/templates/app/build/record/docker-compose.yml +16 -6
- stoobly_agent/app/cli/scaffold/templates/app/build/test/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/build/test/docker-compose.yml +16 -6
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/.docker-compose.base.yml +2 -2
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/docker-compose.yml +16 -10
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/docker-compose.yml +16 -10
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/docker-compose.yml +16 -10
- stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/.docker-compose.base.yml +2 -1
- stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/mock/.docker-compose.mock.yml +6 -3
- stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/record/.docker-compose.record.yml +6 -4
- stoobly_agent/app/cli/scaffold/templates/build/workflows/record/.configure +21 -1
- stoobly_agent/app/cli/scaffold/templates/constants.py +4 -0
- stoobly_agent/app/cli/scaffold/templates/plugins/cypress/test/.Dockerfile.cypress +22 -0
- stoobly_agent/app/cli/scaffold/templates/plugins/cypress/test/.docker-compose.test.yml +19 -0
- stoobly_agent/app/cli/scaffold/templates/plugins/playwright/test/.Dockerfile.playwright +33 -0
- stoobly_agent/app/cli/scaffold/templates/plugins/playwright/test/.docker-compose.test.yml +18 -0
- stoobly_agent/app/cli/scaffold/templates/plugins/playwright/test/.entrypoint.sh +11 -0
- stoobly_agent/app/cli/scaffold/templates/workflow/mock/bin/configure +2 -10
- stoobly_agent/app/cli/scaffold/templates/workflow/mock/docker-compose.yml +17 -0
- stoobly_agent/app/cli/scaffold/templates/workflow/record/bin/configure +19 -45
- stoobly_agent/app/cli/scaffold/templates/workflow/record/docker-compose.yml +17 -0
- stoobly_agent/app/cli/scaffold/templates/workflow/test/bin/configure +2 -10
- stoobly_agent/app/cli/scaffold/templates/workflow/test/docker-compose.yml +17 -0
- stoobly_agent/app/cli/scaffold/workflow_create_command.py +0 -1
- stoobly_agent/app/cli/scaffold/workflow_run_command.py +1 -1
- stoobly_agent/app/cli/scaffold_cli.py +85 -96
- stoobly_agent/app/proxy/handle_record_service.py +12 -3
- stoobly_agent/app/proxy/handle_replay_service.py +14 -2
- stoobly_agent/app/proxy/intercept_settings.py +12 -8
- stoobly_agent/app/proxy/record/upload_request_service.py +5 -8
- stoobly_agent/app/proxy/replay/replay_request_service.py +3 -0
- stoobly_agent/app/proxy/run.py +3 -28
- stoobly_agent/app/proxy/utils/allowed_request_service.py +3 -2
- stoobly_agent/app/proxy/utils/minimize_headers.py +47 -0
- stoobly_agent/app/proxy/utils/publish_change_service.py +22 -24
- stoobly_agent/app/proxy/utils/strategy.py +16 -0
- stoobly_agent/app/settings/__init__.py +15 -6
- stoobly_agent/app/settings/data_rules.py +25 -1
- stoobly_agent/app/settings/intercept_settings.py +5 -2
- stoobly_agent/app/settings/types/__init__.py +0 -1
- stoobly_agent/app/settings/ui_settings.py +5 -5
- stoobly_agent/cli.py +41 -16
- stoobly_agent/config/constants/custom_headers.py +1 -0
- stoobly_agent/config/constants/env_vars.py +4 -3
- stoobly_agent/config/constants/record_strategy.py +6 -0
- stoobly_agent/config/data_dir.py +1 -0
- stoobly_agent/config/settings.yml.sample +2 -3
- stoobly_agent/lib/logger.py +15 -5
- stoobly_agent/public/index.html +1 -1
- stoobly_agent/public/main-es2015.5a9aa16433404c3f423a.js +1 -0
- stoobly_agent/public/main-es5.5a9aa16433404c3f423a.js +1 -0
- stoobly_agent/test/app/cli/intercept/intercept_configure_test.py +231 -1
- stoobly_agent/test/app/cli/scaffold/cli_invoker.py +3 -2
- stoobly_agent/test/app/cli/scaffold/cli_test.py +3 -3
- stoobly_agent/test/app/cli/scaffold/e2e_test.py +11 -11
- stoobly_agent/test/app/models/schemas/.stoobly/db/VERSION +1 -1
- stoobly_agent/test/app/proxy/utils/minimize_headers_test.py +342 -0
- {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/METADATA +2 -1
- {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/RECORD +96 -80
- stoobly_agent/public/main-es2015.089b46f303768fbe864f.js +0 -1
- stoobly_agent/public/main-es5.089b46f303768fbe864f.js +0 -1
- {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/LICENSE +0 -0
- {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/WHEEL +0 -0
- {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/entry_points.txt +0 -0
@@ -7,8 +7,10 @@ from stoobly_agent.test.test_helper import reset
|
|
7
7
|
|
8
8
|
from stoobly_agent.cli import config, intercept, scenario
|
9
9
|
from stoobly_agent.lib.orm.scenario import Scenario
|
10
|
+
from stoobly_agent.app.settings import Settings
|
11
|
+
from stoobly_agent.lib.api.keys.project_key import ProjectKey
|
10
12
|
|
11
|
-
from stoobly_agent.config.constants import mode, record_order
|
13
|
+
from stoobly_agent.config.constants import mode, mock_policy, record_order, record_policy, record_strategy, replay_policy, test_strategy
|
12
14
|
|
13
15
|
@pytest.fixture(scope='module')
|
14
16
|
def runner():
|
@@ -51,3 +53,231 @@ class TestInterceptConfigure():
|
|
51
53
|
assert configure_result.exit_code == 0
|
52
54
|
|
53
55
|
assert not Scenario.find(scenario.id).overwritable
|
56
|
+
|
57
|
+
class TestPolicy():
|
58
|
+
|
59
|
+
class TestMockPolicy():
|
60
|
+
|
61
|
+
def test_policy_mock_mode_all(self, runner: CliRunner):
|
62
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.MOCK, '--policy', mock_policy.ALL])
|
63
|
+
assert configure_result.exit_code == 0
|
64
|
+
|
65
|
+
settings = Settings.instance()
|
66
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
67
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
68
|
+
assert data_rule.mock_policy == mock_policy.ALL
|
69
|
+
|
70
|
+
def test_policy_mock_mode_found(self, runner: CliRunner):
|
71
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.MOCK, '--policy', mock_policy.FOUND])
|
72
|
+
assert configure_result.exit_code == 0
|
73
|
+
|
74
|
+
settings = Settings.instance()
|
75
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
76
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
77
|
+
assert data_rule.mock_policy == mock_policy.FOUND
|
78
|
+
|
79
|
+
def test_policy_without_mode_mock_existing(self, runner: CliRunner):
|
80
|
+
runner.invoke(intercept, ['configure', '--mode', mode.MOCK])
|
81
|
+
configure_result = runner.invoke(intercept, ['configure', '--policy', mock_policy.ALL])
|
82
|
+
assert configure_result.exit_code == 0
|
83
|
+
|
84
|
+
settings = Settings.instance()
|
85
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
86
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
87
|
+
assert data_rule.mock_policy == mock_policy.ALL
|
88
|
+
|
89
|
+
class TestRecordPolicy():
|
90
|
+
|
91
|
+
def test_policy_record_mode_all(self, runner: CliRunner):
|
92
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.RECORD, '--policy', record_policy.ALL])
|
93
|
+
assert configure_result.exit_code == 0
|
94
|
+
|
95
|
+
settings = Settings.instance()
|
96
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
97
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
98
|
+
assert data_rule.record_policy == record_policy.ALL
|
99
|
+
|
100
|
+
def test_policy_record_mode_api(self, runner: CliRunner):
|
101
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.RECORD, '--policy', record_policy.API])
|
102
|
+
assert configure_result.exit_code == 0
|
103
|
+
|
104
|
+
settings = Settings.instance()
|
105
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
106
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
107
|
+
assert data_rule.record_policy == record_policy.API
|
108
|
+
|
109
|
+
def test_policy_record_mode_found(self, runner: CliRunner):
|
110
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.RECORD, '--policy', record_policy.FOUND])
|
111
|
+
assert configure_result.exit_code == 0
|
112
|
+
|
113
|
+
settings = Settings.instance()
|
114
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
115
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
116
|
+
assert data_rule.record_policy == record_policy.FOUND
|
117
|
+
|
118
|
+
def test_policy_record_mode_not_found(self, runner: CliRunner):
|
119
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.RECORD, '--policy', record_policy.NOT_FOUND])
|
120
|
+
assert configure_result.exit_code == 0
|
121
|
+
|
122
|
+
settings = Settings.instance()
|
123
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
124
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
125
|
+
assert data_rule.record_policy == record_policy.NOT_FOUND
|
126
|
+
|
127
|
+
def test_policy_without_mode_record_existing(self, runner: CliRunner):
|
128
|
+
runner.invoke(intercept, ['configure', '--mode', mode.RECORD])
|
129
|
+
configure_result = runner.invoke(intercept, ['configure', '--policy', record_policy.API])
|
130
|
+
assert configure_result.exit_code == 0
|
131
|
+
|
132
|
+
settings = Settings.instance()
|
133
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
134
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
135
|
+
assert data_rule.record_policy == record_policy.API
|
136
|
+
|
137
|
+
class TestReplayPolicy():
|
138
|
+
|
139
|
+
def test_policy_replay_mode_all(self, runner: CliRunner):
|
140
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.REPLAY, '--policy', replay_policy.ALL])
|
141
|
+
assert configure_result.exit_code == 0
|
142
|
+
|
143
|
+
settings = Settings.instance()
|
144
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
145
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
146
|
+
assert data_rule.replay_policy == replay_policy.ALL
|
147
|
+
|
148
|
+
def test_policy_without_mode_replay_existing(self, runner: CliRunner):
|
149
|
+
runner.invoke(intercept, ['configure', '--mode', mode.REPLAY])
|
150
|
+
configure_result = runner.invoke(intercept, ['configure', '--policy', replay_policy.ALL])
|
151
|
+
assert configure_result.exit_code == 0
|
152
|
+
|
153
|
+
settings = Settings.instance()
|
154
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
155
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
156
|
+
assert data_rule.replay_policy == replay_policy.ALL
|
157
|
+
|
158
|
+
class TestTestPolicy():
|
159
|
+
|
160
|
+
def test_policy_test_mode_found(self, runner: CliRunner):
|
161
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.TEST, '--policy', mock_policy.FOUND])
|
162
|
+
assert configure_result.exit_code == 0
|
163
|
+
|
164
|
+
settings = Settings.instance()
|
165
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
166
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
167
|
+
assert data_rule.test_policy == mock_policy.FOUND
|
168
|
+
|
169
|
+
def test_policy_without_mode_test_existing(self, runner: CliRunner):
|
170
|
+
runner.invoke(intercept, ['configure', '--mode', mode.TEST])
|
171
|
+
configure_result = runner.invoke(intercept, ['configure', '--policy', mock_policy.FOUND])
|
172
|
+
assert configure_result.exit_code == 0
|
173
|
+
|
174
|
+
settings = Settings.instance()
|
175
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
176
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
177
|
+
assert data_rule.test_policy == mock_policy.FOUND
|
178
|
+
|
179
|
+
class TestInvalidPolicyInput():
|
180
|
+
# Since all modes use 'all', we need to check what's unique to each mode
|
181
|
+
|
182
|
+
def test_policy_invalid_for_mock_mode(self, runner: CliRunner):
|
183
|
+
# Use record_policy.API which is not valid for MOCK mode
|
184
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.MOCK, '--policy', record_policy.API])
|
185
|
+
assert configure_result.exit_code == 1
|
186
|
+
assert "Error: Valid policies for" in configure_result.output
|
187
|
+
|
188
|
+
def test_policy_invalid_for_record_mode(self, runner: CliRunner):
|
189
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.MOCK, '--policy', record_policy.NOT_FOUND])
|
190
|
+
assert configure_result.exit_code == 1
|
191
|
+
assert "Error: Valid policies for" in configure_result.output
|
192
|
+
|
193
|
+
def test_policy_invalid_for_replay_mode(self, runner: CliRunner):
|
194
|
+
# Use record_policy.API which is not valid for REPLAY mode
|
195
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.REPLAY, '--policy', record_policy.API])
|
196
|
+
assert configure_result.exit_code == 1
|
197
|
+
assert "Error: Valid policies for" in configure_result.output
|
198
|
+
|
199
|
+
def test_policy_invalid_for_test_mode(self, runner: CliRunner):
|
200
|
+
# Use record_policy.API which is not valid for TEST mode
|
201
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.TEST, '--policy', record_policy.API])
|
202
|
+
assert configure_result.exit_code == 1
|
203
|
+
assert "Error: Valid policies for" in configure_result.output
|
204
|
+
|
205
|
+
class TestStrategy():
|
206
|
+
|
207
|
+
class TestRecordStrategy():
|
208
|
+
|
209
|
+
def test_strategy_record_mode_full(self, runner: CliRunner):
|
210
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.RECORD, '--strategy', record_strategy.FULL])
|
211
|
+
assert configure_result.exit_code == 0
|
212
|
+
|
213
|
+
settings = Settings.instance()
|
214
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
215
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
216
|
+
assert data_rule.record_strategy == record_strategy.FULL
|
217
|
+
|
218
|
+
def test_strategy_record_mode_minimal(self, runner: CliRunner):
|
219
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.RECORD, '--strategy', record_strategy.MINIMAL])
|
220
|
+
assert configure_result.exit_code == 0
|
221
|
+
|
222
|
+
settings = Settings.instance()
|
223
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
224
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
225
|
+
assert data_rule.record_strategy == record_strategy.MINIMAL
|
226
|
+
|
227
|
+
def test_strategy_without_mode_record_existing(self, runner: CliRunner):
|
228
|
+
runner.invoke(intercept, ['configure', '--mode', mode.RECORD])
|
229
|
+
configure_result = runner.invoke(intercept, ['configure', '--strategy', record_strategy.MINIMAL])
|
230
|
+
assert configure_result.exit_code == 0
|
231
|
+
|
232
|
+
settings = Settings.instance()
|
233
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
234
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
235
|
+
assert data_rule.record_strategy == record_strategy.MINIMAL
|
236
|
+
|
237
|
+
@pytest.mark.skip(reason="Switching modes during tests is finnicky and leads to test failures")
|
238
|
+
class TestTestStrategy():
|
239
|
+
|
240
|
+
def test_strategy_test_mode_contract(self, runner: CliRunner):
|
241
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.TEST, '--strategy', test_strategy.CONTRACT])
|
242
|
+
assert configure_result.exit_code == 0
|
243
|
+
|
244
|
+
settings = Settings.instance()
|
245
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
246
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
247
|
+
assert data_rule.test_strategy == test_strategy.CONTRACT
|
248
|
+
|
249
|
+
def test_strategy_test_mode_diff(self, runner: CliRunner):
|
250
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.TEST, '--strategy', test_strategy.DIFF])
|
251
|
+
assert configure_result.exit_code == 0
|
252
|
+
|
253
|
+
settings = Settings.instance()
|
254
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
255
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
256
|
+
assert data_rule.test_strategy == test_strategy.DIFF
|
257
|
+
|
258
|
+
def test_strategy_without_mode_test_existing(self, runner: CliRunner):
|
259
|
+
runner.invoke(intercept, ['configure', '--mode', mode.TEST])
|
260
|
+
configure_result = runner.invoke(intercept, ['configure', '--strategy', test_strategy.FUZZY])
|
261
|
+
assert configure_result.exit_code == 0
|
262
|
+
|
263
|
+
settings = Settings.instance()
|
264
|
+
project_key = ProjectKey(settings.proxy.intercept.project_key)
|
265
|
+
data_rule = settings.proxy.data.data_rules(project_key.id)
|
266
|
+
assert data_rule.test_strategy == test_strategy.FUZZY
|
267
|
+
|
268
|
+
class TestInvalidInput():
|
269
|
+
def test_strategy_mock_mode_error(self, runner: CliRunner):
|
270
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.MOCK, '--strategy', record_strategy.FULL])
|
271
|
+
assert configure_result.exit_code == 1
|
272
|
+
assert "Error: set --strategy to a intercept mode that supports the strategy option" in configure_result.output
|
273
|
+
|
274
|
+
def test_strategy_replay_mode_error(self, runner: CliRunner):
|
275
|
+
configure_result = runner.invoke(intercept, ['configure', '--mode', mode.REPLAY, '--strategy', record_strategy.FULL])
|
276
|
+
assert configure_result.exit_code == 1
|
277
|
+
assert "Error: set --strategy to a intercept mode that supports the strategy option" in configure_result.output
|
278
|
+
|
279
|
+
def test_strategy_without_mode_unsupported_existing(self, runner: CliRunner):
|
280
|
+
runner.invoke(intercept, ['configure', '--mode', mode.MOCK])
|
281
|
+
configure_result = runner.invoke(intercept, ['configure', '--strategy', record_strategy.FULL])
|
282
|
+
assert configure_result.exit_code == 1
|
283
|
+
assert "Error: set --strategy to a intercept mode that supports the strategy option" in configure_result.output
|
@@ -66,14 +66,15 @@ class ScaffoldCliInvoker():
|
|
66
66
|
if https == True:
|
67
67
|
scheme = 'https'
|
68
68
|
port = '443'
|
69
|
-
proxy_mode_reverse_spec = f"reverse:{scheme}://{hostname}:8080"
|
70
69
|
|
71
70
|
result = runner.invoke(scaffold, ['service', 'create',
|
72
71
|
'--app-dir-path', app_dir_path,
|
73
72
|
'--hostname', hostname,
|
74
73
|
'--scheme', scheme,
|
75
74
|
'--port', port,
|
76
|
-
'--
|
75
|
+
'--upstream-hostname', hostname,
|
76
|
+
'--upstream-port', 80,
|
77
|
+
'--upstream-scheme', 'http',
|
77
78
|
'--detached',
|
78
79
|
'--quiet',
|
79
80
|
'--workflow', 'test',
|
@@ -7,7 +7,7 @@ import pytest
|
|
7
7
|
|
8
8
|
from stoobly_agent.app.cli.scaffold.app import App
|
9
9
|
from stoobly_agent.app.cli.scaffold.constants import (
|
10
|
-
|
10
|
+
SERVICES_NAMESPACE,
|
11
11
|
WORKFLOW_RECORD_TYPE,
|
12
12
|
)
|
13
13
|
from stoobly_agent.app.cli.scaffold.service_docker_compose import ServiceDockerCompose
|
@@ -90,7 +90,7 @@ class TestScaffoldCli():
|
|
90
90
|
|
91
91
|
|
92
92
|
def test_service_delete(self, runner, app_dir_path, external_service_docker_compose):
|
93
|
-
app = App(app_dir_path,
|
93
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
94
94
|
service_name = external_service_docker_compose.service_name
|
95
95
|
|
96
96
|
ScaffoldCliInvoker.cli_service_delete(runner, app_dir_path, service_name)
|
@@ -105,7 +105,7 @@ class TestScaffoldCli():
|
|
105
105
|
assert False
|
106
106
|
|
107
107
|
def test_service_delete_https(self, runner, app_dir_path, external_https_service_docker_compose):
|
108
|
-
app = App(app_dir_path,
|
108
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
109
109
|
service_name = external_https_service_docker_compose.service_name
|
110
110
|
hostname = external_https_service_docker_compose.hostname
|
111
111
|
|
@@ -7,7 +7,7 @@ import pytest
|
|
7
7
|
|
8
8
|
from stoobly_agent.app.cli.scaffold.app import App
|
9
9
|
from stoobly_agent.app.cli.scaffold.constants import (
|
10
|
-
|
10
|
+
SERVICES_NAMESPACE,
|
11
11
|
WORKFLOW_RECORD_TYPE,
|
12
12
|
WORKFLOW_TEST_TYPE,
|
13
13
|
)
|
@@ -138,7 +138,7 @@ class TestScaffoldE2e():
|
|
138
138
|
shutil.rmtree(app_dir_path)
|
139
139
|
|
140
140
|
def test_core_services(self, app_dir_path, target_workflow_name):
|
141
|
-
app = App(app_dir_path,
|
141
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
142
142
|
config = {
|
143
143
|
'workflow_name': target_workflow_name,
|
144
144
|
'service_name': 'build'
|
@@ -148,7 +148,7 @@ class TestScaffoldE2e():
|
|
148
148
|
command.validate()
|
149
149
|
|
150
150
|
def test_external_service(self, external_service_docker_compose: ServiceDockerCompose, app_dir_path, target_workflow_name):
|
151
|
-
app = App(app_dir_path,
|
151
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
152
152
|
config = {
|
153
153
|
'workflow_name': target_workflow_name,
|
154
154
|
'service_name': external_service_docker_compose.service_name
|
@@ -158,7 +158,7 @@ class TestScaffoldE2e():
|
|
158
158
|
command.validate()
|
159
159
|
|
160
160
|
def test_local_service(self, app_dir_path, target_workflow_name, local_service_docker_compose: ServiceDockerCompose):
|
161
|
-
app = App(app_dir_path,
|
161
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
162
162
|
config = {
|
163
163
|
'workflow_name': target_workflow_name,
|
164
164
|
'service_name': local_service_docker_compose.service_name
|
@@ -223,7 +223,7 @@ class TestScaffoldE2e():
|
|
223
223
|
ScaffoldCliInvoker.cli_service_create(runner, app_dir_path, external_service_docker_compose.hostname, external_service_docker_compose.service_name, False)
|
224
224
|
# Create local user defined services
|
225
225
|
ScaffoldCliInvoker.cli_service_create(runner, app_dir_path, local_service_docker_compose.hostname, local_service_docker_compose.service_name, False)
|
226
|
-
ScaffoldCliInvoker.cli_service_create_assets(runner, app_dir_path, assets_service_docker_compose.hostname, assets_service_docker_compose.service_name,
|
226
|
+
ScaffoldCliInvoker.cli_service_create_assets(runner, app_dir_path, assets_service_docker_compose.hostname, assets_service_docker_compose.service_name, True)
|
227
227
|
|
228
228
|
# Don't run the local user defined service in the 'test' workflow
|
229
229
|
# So don't copy the Docker Compose file over
|
@@ -233,17 +233,17 @@ class TestScaffoldE2e():
|
|
233
233
|
assert destination_path.is_file()
|
234
234
|
shutil.copyfile(assets_service_mock_docker_compose_path, destination_path)
|
235
235
|
|
236
|
-
ScaffoldCliInvoker.cli_service_create_assets(runner, app_dir_path, assets_service_docker_compose.hostname, assets_service_docker_compose.service_name,
|
236
|
+
ScaffoldCliInvoker.cli_service_create_assets(runner, app_dir_path, assets_service_docker_compose.hostname, assets_service_docker_compose.service_name, True)
|
237
237
|
|
238
238
|
# Add assets for assets service
|
239
239
|
data_dir_path = DataDir.instance().path
|
240
|
-
destination_assets_path = f"{data_dir_path}/
|
240
|
+
destination_assets_path = f"{data_dir_path}/{SERVICES_NAMESPACE}/{assets_service_docker_compose.service_name}/{target_workflow_name}/index.html"
|
241
241
|
destination_path = Path(destination_assets_path)
|
242
242
|
assets_mock_path = mock_data_directory_path / "scaffold" / "index.html"
|
243
243
|
shutil.copyfile(assets_mock_path, destination_path)
|
244
244
|
|
245
245
|
# Created shared file in fixtures folder
|
246
|
-
app = App(app_dir_path,
|
246
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
247
247
|
config = {
|
248
248
|
'workflow_name': target_workflow_name,
|
249
249
|
'service_name': external_service_docker_compose.service_name
|
@@ -261,7 +261,7 @@ class TestScaffoldE2e():
|
|
261
261
|
shutil.rmtree(app_dir_path)
|
262
262
|
|
263
263
|
def test_no_core_services(self, app_dir_path, target_workflow_name):
|
264
|
-
app = App(app_dir_path,
|
264
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
265
265
|
config = {
|
266
266
|
'workflow_name': target_workflow_name,
|
267
267
|
'service_name': 'build'
|
@@ -271,7 +271,7 @@ class TestScaffoldE2e():
|
|
271
271
|
command.validate()
|
272
272
|
|
273
273
|
def test_user_services(self, app_dir_path, target_workflow_name, external_service_docker_compose, local_service_docker_compose):
|
274
|
-
app = App(app_dir_path,
|
274
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
275
275
|
|
276
276
|
config = {
|
277
277
|
'workflow_name': target_workflow_name,
|
@@ -292,7 +292,7 @@ class TestScaffoldE2e():
|
|
292
292
|
pass
|
293
293
|
|
294
294
|
def test_assets(self, app_dir_path, target_workflow_name):
|
295
|
-
app = App(app_dir_path,
|
295
|
+
app = App(app_dir_path, SERVICES_NAMESPACE)
|
296
296
|
config = {
|
297
297
|
'workflow_name': target_workflow_name,
|
298
298
|
'service_name': 'assets'
|
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.12
|