File tree Expand file tree Collapse file tree 9 files changed +170
-331
lines changed
test_elasticsearch_serverless Expand file tree Collapse file tree 9 files changed +170
-331
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ steps :
3
+ - label : " :elasticsearch: :python: ES Serverless ({{ matrix.python }}/{{ matrix.connection_class }}) Python Test Suite: {{ matrix.suite }}"
4
+ agents :
5
+ provider : gcp
6
+ env :
7
+ PYTHON_VERSION : " {{ matrix.python }}"
8
+ TEST_SUITE : " {{ matrix.suite }}"
9
+ PYTHON_CONNECTION_CLASS : " {{ matrix.connection_class }}"
10
+ matrix :
11
+ setup :
12
+ suite :
13
+ - free
14
+ - platinum
15
+ python :
16
+ - " 3.7"
17
+ - " 3.8"
18
+ - " 3.9"
19
+ - " 3.10"
20
+ - " 3.11"
21
+ connection_class :
22
+ - urrlib3
23
+ - requests
24
+ command : ./.buildkite/run-tests
25
+ artifact_paths : " junit/*-junit.xml"
26
+ - wait : ~
27
+ continue_on_failure : true
28
+ - label : " :junit: Test results"
29
+ agents :
30
+ provider : gcp
31
+ image : family/core-ubuntu-2204
32
+ plugins :
33
+ - junit-annotate#v2.4.1:
34
+ artifacts : " junit/*-junit.xml"
35
+ job-uuid-file-pattern : " (.*)-junit.xml"
36
+ fail-build-on-error : true
37
+ failure-format : file
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Default environment variables
4
+ export TEST_SUITE=" ${TEST_SUITE:= platinum} "
5
+ export PYTHON_VERSION=" ${PYTHON_VERSION:= 3.9} "
6
+ export PYTHON_CONNECTION_CLASS=" ${PYTHON_CONNECTION_CLASS:= urllib3} "
7
+
8
+ set -euo pipefail
9
+
10
+ echo -e " --- :elasticsearch: Start serverless instance"
11
+ # TODO
12
+
13
+ echo -e " --- :computer: Environment variables"
14
+ echo -e " ELASTICSEARCH_URL $ELASTICSEARCH_URL "
15
+ echo -e " STACK_VERSION $STACK_VERSION "
16
+ echo -e " TEST_SUITE $TEST_SUITE "
17
+ echo -e " PYTHON_VERSION $PYTHON_VERSION "
18
+ echo -e " PYTHON_CONNECTION_CLASS $PYTHON_CONNECTION_CLASS "
19
+
20
+ echo -e " --- :docker: Build elasticsearch-serverless-python container"
21
+
22
+ docker build \
23
+ --file .ci/Dockerfile \
24
+ --tag elasticsearch-serverless-python \
25
+ --build-arg " PYTHON_VERSION=$PYTHON_VERSION " \
26
+ .
27
+
28
+ echo -e " --- :docker: :python: Run integration tests for Python $PYTHON_VERSION "
29
+
30
+ docker run \
31
+ --env STACK_VERSION \
32
+ --env ELASTICSEARCH_URL \
33
+ --env TEST_SUITE \
34
+ --env PYTHON_CONNECTION_CLASS \
35
+ --env ES_API_KEY \
36
+ --name elasticsearch-serverless-python-tests \
37
+ --volume " $( pwd) /junit:/code/elasticsearch-serverless-python/junit" \
38
+ --rm \
39
+ elasticsearch-serverless-python \
40
+ nox -s " test-$PYTHON_VERSION "
41
+
42
+ echo -e " --- :elasticsearch: Tear down serverless instance"
43
+ echo " TODO"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ ---
2
+ # yaml-language-server: $schema=https://json.schemastore.org/catalog-info.json
3
+ apiVersion : backstage.io/v1alpha1
4
+ kind : Component
5
+ metadata :
6
+ name : elasticsearch-serverless-python
7
+ spec :
8
+ type : library
9
+ owner : group:clients-team
10
+ lifecycle : production
11
+
12
+ ---
13
+ # yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
14
+ apiVersion : backstage.io/v1alpha1
15
+ kind : Resource
16
+ metadata :
17
+ name : elasticsearch-serverless-python-rest-tests
18
+ description : elasticsearch-serverless-python - rest tests
19
+ spec :
20
+ type : buildkite-pipeline
21
+ owner : group:clients-team
22
+ system : buildkite
23
+ implementation :
24
+ apiVersion : buildkite.elastic.dev/v1
25
+ kind : Pipeline
26
+ metadata :
27
+ name : elasticsearch-serverless-python - rest tests
28
+ spec :
29
+ repository : elastic/elasticsearch-serverless-python
30
+ pipeline_file : .buildkite/rest-tests.yaml
31
+ teams :
32
+ clients-team :
33
+ access_level : MANAGE_BUILD_AND_READ
34
+ provider_settings :
35
+ build_pull_requests : true
36
+ build_branches : true
37
+ cancel_intermediate_builds : true
38
+ cancel_intermediate_builds_branch_filter : ' !main'
39
+ schedules :
40
+ main_semi_daily :
41
+ branch : ' main'
42
+ cronline : ' 0 */12 * * *'
Original file line number Diff line number Diff line change 21
21
22
22
from elasticsearch_serverless import Elasticsearch
23
23
24
- from .utils import CA_CERTS , es_url , es_version
24
+ from .utils import es_url , es_version
25
25
26
26
27
27
@pytest .fixture (scope = "session" )
@@ -33,11 +33,6 @@ def elasticsearch_url():
33
33
34
34
35
35
@pytest .fixture (scope = "session" )
36
- def ca_certs ():
37
- return CA_CERTS
38
-
39
-
40
- @pytest .fixture (scope = "session" )
41
- def elasticsearch_version (elasticsearch_url , ca_certs ) -> Tuple [int , ...]:
36
+ def elasticsearch_version (elasticsearch_url ) -> Tuple [int , ...]:
42
37
"""Returns the version of the current Elasticsearch cluster"""
43
- return es_version (Elasticsearch (elasticsearch_url , ca_certs = ca_certs ))
38
+ return es_version (Elasticsearch (elasticsearch_url ))
Original file line number Diff line number Diff line change 19
19
20
20
import elasticsearch_serverless
21
21
22
- from ...utils import CA_CERTS , wipe_cluster
22
+ from ...utils import wipe_cluster
23
23
24
24
pytestmark = pytest .mark .asyncio
25
25
@@ -38,7 +38,7 @@ async def async_client(elasticsearch_url):
38
38
client = None
39
39
try :
40
40
client = elasticsearch_serverless .AsyncElasticsearch (
41
- elasticsearch_url , request_timeout = 3 , ca_certs = CA_CERTS
41
+ elasticsearch_url , request_timeout = 3
42
42
)
43
43
yield client
44
44
finally :
Original file line number Diff line number Diff line change 21
21
22
22
import elasticsearch_serverless
23
23
24
- from ..utils import CA_CERTS , wipe_cluster
24
+ from ..utils import wipe_cluster , es_api_key
25
25
26
26
# Information about the Elasticsearch instance running, if any
27
27
# Used for
34
34
def sync_client_factory (elasticsearch_url ):
35
35
client = None
36
36
try :
37
- # Configure the client with certificates and optionally
37
+ # Configure the client with API key and optionally
38
38
# an HTTP conn class depending on 'PYTHON_CONNECTION_CLASS' envvar
39
- kw = {"ca_certs" : CA_CERTS }
39
+ kw = {}
40
40
if "PYTHON_CONNECTION_CLASS" in os .environ :
41
41
kw ["node_class" ] = os .environ ["PYTHON_CONNECTION_CLASS" ]
42
42
43
43
# We do this little dance with the URL to force
44
44
# Requests to respect 'headers: None' within rest API spec tests.
45
- client = elasticsearch_serverless .Elasticsearch (elasticsearch_url , ** kw )
45
+ client = elasticsearch_serverless .Elasticsearch (elasticsearch_url , api_key = es_api_key (), ** kw )
46
46
47
47
# Wipe the cluster before we start testing just in case it wasn't wiped
48
48
# cleanly from the previous run of pytest?
Original file line number Diff line number Diff line change 42
42
from elasticsearch_serverless ._sync .client .utils import _base64_auth_header
43
43
from elasticsearch_serverless .compat import string_types
44
44
45
- from ..utils import CA_CERTS , es_url , parse_version
45
+ from ..utils import es_url , es_api_key , parse_version
46
46
47
47
# some params had to be changed in python, keep track of them so we can rename
48
48
# those in the tests accordingly
@@ -555,7 +555,7 @@ def remove_implicit_resolver(cls, tag_to_remove):
555
555
try :
556
556
# Construct the HTTP and Elasticsearch client
557
557
http = urllib3 .PoolManager (retries = 10 )
558
- client = Elasticsearch (es_url (), request_timeout = 3 , ca_certs = CA_CERTS )
558
+ client = Elasticsearch (es_url (), api_key = es_api_key (), request_timeout = 3 )
559
559
560
560
# Make a request to Elasticsearch for the build hash, we'll be looking for
561
561
# an artifact with this same hash to download test specs for.
You can’t perform that action at this time.
0 commit comments