[7.x] Start using the Elastic Artifacts API for YAML REST tests

This commit is contained in:
Seth Michael Larson
2021-04-22 12:08:05 -05:00
committed by GitHub
parent 1d96f26fab
commit 794a97578f
13 changed files with 205 additions and 91 deletions
+5 -3
View File
@@ -325,7 +325,7 @@ class API:
@contextlib.contextmanager
def download_artifact(version):
# Download the list of all artifacts for a version
# and find the latest build URL for 'rest-api-spec-X.jar'
# and find the latest build URL for 'rest-resources-zip-*.zip'
resp = http.request(
"GET", f"https://artifacts-api.elastic.co/v1/versions/{version}"
)
@@ -333,11 +333,13 @@ def download_artifact(version):
"elasticsearch"
]["packages"]
for package in packages:
if re.match(r"^rest-api-spec-.*-sources\.jar$", package):
if re.match(r"^rest-resources-zip-.*\.zip$", package):
zip_url = packages[package]["url"]
break
else:
raise ValueError("Could not find 'rest-api-spec'")
raise RuntimeError(
"Could not find the package 'rest-resources-zip-*.zip' in build"
)
# Download the .jar file and unzip only the API
# .json files into a temporary directory