Skip to content

Commit 7b2bd8f

Browse files
committed
Spin up and tear down ES serverless instances on Buildkite tests
1 parent af25a68 commit 7b2bd8f

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

.buildkite/rest-tests.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ steps:
1414
FROZENLIST_NO_EXTENSIONS: 1
1515
# https://github.com/aio-libs/yarl/issues/680
1616
YARL_NO_EXTENSIONS: 1
17+
EC_REGISTER_BACKEND: "appex-qa-team-cluster"
18+
EC_ENV: "qa"
19+
EC_REGION: "aws-eu-west-1"
20+
EC_PROJECT_NAME: "esv-client-python-test-{{ matrix.python }}-{{ matrix.suite }}-{{ matrix.connection_class }}"
1721
matrix:
1822
setup:
1923
suite:

.buildkite/run-tests

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@ export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=urllib3}"
88
set -euo pipefail
99

1010
echo -e "--- :elasticsearch: Start serverless instance"
11-
# TODO
11+
deployment=$(docker run --rm \
12+
-e EC_REGISTER_BACKEND \
13+
-e EC_ENV \
14+
-e EC_REGION \
15+
-e EC_PROJECT_NAME \
16+
docker.elastic.co/employees/dolaru/qaf:latest \
17+
bash -c 'qaf elastic-cloud projects create --project-type elasticsearch && \
18+
qaf elastic-cloud projects describe --as-json --show-credentials') \
19+
20+
ES_API_KEY=$(echo "$deployment" | jq -r '.credentials.api_key')
21+
export ES_API_KEY
22+
ELASTICSEARCH_URL=$(echo "$deployment" | jq -r '.elasticsearch.url')
23+
export ELASTICSEARCH_URL
1224

1325
echo -e "--- :computer: Environment variables"
1426
echo -e "ELASTICSEARCH_URL $ELASTICSEARCH_URL"
@@ -28,16 +40,22 @@ docker build \
2840
echo -e "--- :docker: :python: Run integration tests for Python $PYTHON_VERSION"
2941

3042
docker run \
31-
--env STACK_VERSION \
32-
--env ELASTICSEARCH_URL \
33-
--env TEST_SUITE \
34-
--env PYTHON_CONNECTION_CLASS \
35-
--env ES_API_KEY \
43+
-e ELASTICSEARCH_URL \
44+
-e ES_API_KEY \
45+
-e PYTHON_CONNECTION_CLASS \
46+
-e STACK_VERSION \
47+
-e TEST_SUITE \
3648
--name elasticsearch-serverless-python-tests \
3749
--volume "$(pwd)/junit:/code/elasticsearch-serverless-python/junit" \
3850
--rm \
3951
elasticsearch-serverless-python \
4052
nox -s "test-$PYTHON_VERSION"
4153

4254
echo -e "--- :elasticsearch: Tear down serverless instance"
43-
echo "TODO"
55+
deployment=$(docker run --rm \
56+
-e EC_REGISTER_BACKEND \
57+
-e EC_ENV \
58+
-e EC_REGION \
59+
-e EC_PROJECT_NAME \
60+
docker.elastic.co/employees/dolaru/qaf:latest \
61+
bash -c 'qaf elastic-cloud projects delete') \

0 commit comments

Comments
 (0)