Skip to content

Integration test runner #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 25, 2023
Merged

Integration test runner #12

merged 15 commits into from
Sep 25, 2023

Conversation

JoshMock
Copy link
Member

@JoshMock JoshMock commented Sep 12, 2023

Gets integration test suite running, including fixing a few bugs due to copy/pasting from the stack client. And adds a Buildkite pipeline for it.

Several pieces of stack-specific functionality have been removed from tests, and dependence on an API key has been added to properly reflect Serverless.

Not all of these test pass yet. Many async tests are flaky due to setup/teardown issues in the ES instance, mapbox vector tile tests fail because I need to regenerate the API from latest spec changes, and there are a few places where I haven't landed on the best way to refresh indices. I'll fix these issues in separate PRs.

A couple secrets still need to be created in the CI Vault instance:

  • secret/ci/elastic-elasticsearch-serverless-python/cloud-access
  • secret/ci/elastic-elasticsearch-serverless-python/github-token

I can't create them until this merges because https://github.com/elastic/catalog-info/pull/558 needs the catalog-info.yaml file created in this PR.

With fixes for several test breakages.

Integration tests will always run against a real serverless instance
that has its own certs. That instance is created using qaf, one per test
suite run (so several are created for each matrix-based test run), and then
deleted when tests are done running.
Since serverless projects provide users with an endpoint that does not
include a port, we should assume HTTPS means port 443.
Instead of using the entire set of YAML REST tests from the
elasticsearch repo.
@JoshMock JoshMock marked this pull request as ready for review September 21, 2023 19:37
EC_REGISTER_BACKEND: "appex-qa-team-cluster"
EC_ENV: "qa"
EC_REGION: "aws-eu-west-1"
EC_PROJECT_NAME: "esv-client-python-test-{{ matrix.python }}-{{ matrix.suite }}-{{ matrix.connection_class }}-{{ key }}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another improvement I hope to make soon is to spin up a single serverless project for the whole matrix, ensuring each test run in the matrix uses a unique prefix (probably the Buildkite step ID) on all resources created in Elasticsearch. It's slow, ugly and expensive to set up several serverless instances every time this test suite is run.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM. My comments can be addressed in later PRs.

async_client,
"test_index",
"prod_index",
bulk_kwargs={"refresh": "wait_for"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refreshing is costly in serverless as it requires going to the object store. Thankfully grepping for refresh in the test only finds test_helpers and one entry in test_elasticsearch_serverless/test_async/test_server/test_mapbox_vector_tile.py. But Is there any particular reason to use ?refresh=wait_for here? I know I've advocated for this before, but I thought it was much more efficient than it is.

Indeed, refresh=wait_for waits for the next refresh interval, which is currently 15s! refresh=True has burst capacity, and in the worse case it will be throttled to one refresh per 5 seconds, which sounds better here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was just trying to figure out how to update this refresh to ensure the test I copied from elasticsearch-py would keep passing. I intend to address all refreshes in a follow-up because I believe that change is the cause of quite a few test failures.

@@ -114,22 +63,12 @@ def wipe_cluster(client):

if isinstance(client, AsyncElasticsearch):
node_config = client.transport.node_pool.get().config
client = Elasticsearch(node_config, verify_certs=False)
client = Elasticsearch([node_config])
close_after_wipe = True
except ImportError:
pass

is_xpack = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since is_xpack is unconditionally True, why do we still have conditions below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will clean up soon.

@JoshMock JoshMock merged commit 215b54e into main Sep 25, 2023
@JoshMock JoshMock deleted the integration-tests branch September 25, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants