Skip to content

Commit 1a31b04

Browse files
authored
WIP: add flag to detect if UPS is on or off in accept tests (#341)
* add flag - i statement to run tests if ups is present or not * test_decide_feature now has upn and no-ups version * add a different function url_points_to_cluster * add ups flag to test_decide__flag_key_parameter * fix expected response * add ups toggle to tests for ups save * revert changes to test_ups.py file, readme addition * cleanup * separate ups and non-ups tests, remove if condition
1 parent 43fc70a commit 1a31b04

File tree

4 files changed

+227
-65
lines changed

4 files changed

+227
-65
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,6 @@ test-acceptance:
9696
make setup && \
9797
make run & \
9898
bash scripts/wait_for_agent_to_start.sh && \
99-
pytest -vv -rA --diff-symbols tests/acceptance/test_acceptance/ -k "$(TEST)" --host "$(MYHOST)" && \
99+
pytest -vv -rA --diff-symbols tests/acceptance/test_acceptance/ \
100+
-k "not test_decide__feature_no_ups and not test_decide__flag_key_parameter_no_ups" --host "$(MYHOST)" && \
100101
make stop

tests/acceptance/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ Run tests
1616

1717
You can point `MYHOST` to any URL where agent service is located.
1818

19-
If you want to run an individual test add TEST variable in front like so:
20-
`TEST="test_activate__disable_tracking" MYHOST="http://localhost:8080" make test-acceptance`
21-
The TEST variable is based on Pytest's -k pattern matching flag so you can provide a full name of the test to only run that test, or a partial name which will run all tests that match that name pattern.
19+
Tests contain a few tests that don't support user profile service. Those tests are intended to be used
20+
by Optimizely at a different place and are therefore excluded from the main test run.

tests/acceptance/helpers.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424

2525
YAML_FILE_PATH = os.getenv('OPENAPI_YAML_PATH', 'api/openapi-spec/openapi.yaml')
2626

27-
spec_dict = None
28-
with open(YAML_FILE_PATH, 'r') as stream:
29-
try:
30-
spec_dict = yaml.safe_load(stream)
31-
except yaml.YAMLError as exc:
32-
print(exc)
3327

34-
spec = create_spec(spec_dict)
28+
def parse_yaml(path):
29+
with open(path, 'r') as stream:
30+
try:
31+
return yaml.safe_load(stream)
32+
except yaml.YAMLError as exc:
33+
print(exc)
34+
35+
36+
spec = create_spec(parse_yaml(YAML_FILE_PATH))
3537

3638

3739
def get_random_string():
@@ -43,7 +45,7 @@ def get_random_string():
4345

4446
def get_pretty_json(dictionary, spaces=4):
4547
"""
46-
Makes JSON output prettuer and readable.
48+
Makes JSON output prettier and readable.
4749
:return: stringified JSON
4850
"""
4951
return json.dumps(dictionary, indent=spaces)

0 commit comments

Comments
 (0)