From c7425a5da30d482bea337e3253501163414b8d2b Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Fri, 21 Nov 2025 18:13:44 +0000 Subject: [PATCH] yaml tests: more improvements to branching logic (#3197) (cherry picked from commit 01d1e81b0144fdcaaf9a075af1a168681d5b5447) --- .buildkite/run-tests | 3 +++ test_elasticsearch/test_server/test_rest_api_spec.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.buildkite/run-tests b/.buildkite/run-tests index a9077179e..d2403c3a9 100755 --- a/.buildkite/run-tests +++ b/.buildkite/run-tests @@ -10,6 +10,9 @@ export TEST_SUITE="${TEST_SUITE:=platinum}" export PYTHON_VERSION="${PYTHON_VERSION:=3.14}" export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=urllib3}" export ES_YAML_TESTS_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" +if [[ ! -n "$ES_YAML_TESTS_BRANCH" ]]; then + export ES_YAML_TESTS_BRANCH="${BUILDKITE_BRANCH}" +fi script_path=$(dirname $(realpath $0)) source $script_path/functions/imports.sh diff --git a/test_elasticsearch/test_server/test_rest_api_spec.py b/test_elasticsearch/test_server/test_rest_api_spec.py index 1fd52e926..aed7c31e7 100644 --- a/test_elasticsearch/test_server/test_rest_api_spec.py +++ b/test_elasticsearch/test_server/test_rest_api_spec.py @@ -503,10 +503,10 @@ def remove_implicit_resolver(cls, tag_to_remove): if "ES_YAML_TESTS_BRANCH" in os.environ and os.environ["ES_YAML_TESTS_BRANCH"]: branch_candidates.append(os.environ["ES_YAML_TESTS_BRANCH"]) git_branch = subprocess.getoutput("git branch --show-current") - if git_branch not in branch_candidates: + if git_branch and git_branch not in branch_candidates: branch_candidates.append(git_branch) package_version = __versionstr__.rsplit(".", 1)[0] - if package_version not in branch_candidates: + if package_version and package_version not in branch_candidates: branch_candidates.append(package_version) if "main" not in branch_candidates: branch_candidates.append("main")