diff --git a/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py b/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py index 5df6ab9..c7880b3 100644 --- a/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py +++ b/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py @@ -130,7 +130,9 @@ async def run_do(self, action): headers.pop("Authorization") method, args = list(action.items())[0] - args["headers"] = headers + + if headers: + args["headers"] = headers # locate api endpoint for m in method.split("."): diff --git a/test_elasticsearch_serverless/test_server/test_rest_api_spec.py b/test_elasticsearch_serverless/test_server/test_rest_api_spec.py index d5c486c..ef24e0f 100644 --- a/test_elasticsearch_serverless/test_server/test_rest_api_spec.py +++ b/test_elasticsearch_serverless/test_server/test_rest_api_spec.py @@ -565,16 +565,21 @@ def remove_implicit_resolver(cls, tag_to_remove): yaml.load_all(package_zip.read(yaml_file), Loader=NoDatesSafeLoader) ) - # Each file may have a "test" named 'setup' or 'teardown', - # these sets of steps should be run at the beginning and end - # of every other test within the file so we do one pass to capture those. - setup_steps = teardown_steps = None + # Each file has a `requires` section with `serverless` and `stack` + # boolean entries indicating whether the test should run with + # serverless, stack or both. Additionally, each file may have a section + # named 'setup' or 'teardown', these sets of steps should be run at the + # beginning and end of every other test within the file so we do one + # pass to capture those. + requires = setup_steps = teardown_steps = None test_numbers_and_steps = [] test_number = 0 for yaml_test in yaml_tests: test_name, test_step = yaml_test.popitem() - if test_name == "setup": + if test_name == "requires": + requires = test_step + elif test_name == "setup": setup_steps = test_step elif test_name == "teardown": teardown_steps = test_step @@ -582,6 +587,9 @@ def remove_implicit_resolver(cls, tag_to_remove): test_numbers_and_steps.append((test_number, test_step)) test_number += 1 + if not requires["serverless"]: + continue + # Now we combine setup, teardown, and test_steps into # a set of pytest.param() instances for test_number, test_step in test_numbers_and_steps: