Skip to content

Commit 0ccb92d

Browse files
committed
fix: Adapt tests to match with new api testing strategy
1 parent 9feb464 commit 0ccb92d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tools/deployment-cli-tools/ch_cli_tools/codefresh.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,7 @@ def api_tests_commands(app_config: ApplicationHarnessConfig, run_custom_tests, a
462462
if api_config.autotest:
463463
# harness-test requires values.yaml generated & domain; Codefresh sets environment accordingly.
464464
# We limit to the specific app using -i and run only api tests with -a
465-
commands.append(f"echo $CH_VALUES_PATH")
466465
commands.append(f"cd $CH_VALUES_PATH")
467-
commands.append(f"ls -la")
468466
commands.append(f"harness-test . -i {app_name} -a")
469467
if run_custom_tests:
470468
commands.append("pytest -v test/api")

tools/deployment-cli-tools/tests/test_codefresh.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,17 @@ def test_create_codefresh_configuration_tests():
238238

239239
assert any("allvalues.yaml" in v for v in test_step['volumes'])
240240

241-
assert len(test_step["commands"]) == 2, "Both default and custom api tests should be run"
242-
243-
st_cmd = test_step["commands"][0]
244-
assert any("SCHEMATHESIS_HOOKS=cloudharness_test.apitest_init" in env for env in test_step['environment']), "SCHEMATHESIS_HOOKS hook must be specified in environment"
245-
assert "api/openapi.yaml" in st_cmd, "Openapi file must be passed to the schemathesis command"
246-
247-
assert "-c all" in st_cmd, "Default check loaded is `all` on schemathesis command"
248-
assert "--exclude-deprecated" in st_cmd, "Custom parameters are loaded from values.yaml"
241+
assert len(test_step["commands"]) == 3, "Both default and custom api tests should be run"
242+
243+
# First command should change to the values path
244+
assert test_step["commands"][0] == "cd $CH_VALUES_PATH", "First command should change to values directory"
245+
# Second command should run harness-test with api flag and specific app
246+
harness_test_cmd = test_step["commands"][1]
247+
assert "harness-test" in harness_test_cmd, "harness-test should be used for api tests"
248+
assert "-i samples" in harness_test_cmd, "App name should be included with -i flag"
249+
assert "-a" in harness_test_cmd, "API tests should be run with -a flag"
250+
# Third command should run custom pytest tests
251+
assert "pytest -v test/api" in test_step["commands"][2], "Custom pytest tests should be run"
249252

250253
test_step = api_steps["common_api_test"]
251254
for volume in test_step["volumes"]:

0 commit comments

Comments
 (0)