-
Notifications
You must be signed in to change notification settings - Fork 13
Play around with E2E tests to improve. #377
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
ac25d17
ce078c3
ba95d99
04baf2a
58ed51c
c40c17b
27111e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,7 @@ def generate_steps_for_main_branch(versions) -> list: | |
| structure = { | ||
| "agents": { | ||
| "provider": "gcp", | ||
| "machineType": "n2-standard-4", | ||
| "machineType": "n2-standard-16", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes ES is not reachable, when I spin up VM and tried many times, it doesn't response. It looks like elastic-package fires up so much resource that ES is very slow. Changing the machine type and decreasing number of packages (only m365_defender which has more processors) to test. |
||
| "imageProject": "elastic-images-prod", | ||
| "image": "family/platform-ingest-logstash-multi-jdk-ubuntu-2204", | ||
| "diskSizeGb": 120 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| from plugin_test import PluginTest | ||
| import util | ||
|
|
||
| INTEGRATION_PACKAGES_TO_TEST = ["apache", "m365_defender", "nginx", "tomcat"] | ||
| INTEGRATION_PACKAGES_TO_TEST = ["m365_defender"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we are using a more capable VM are we adding these back?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am thinking to opt out them as they do not provide meaningful values to the test cases. |
||
|
|
||
|
|
||
| class BootstrapContextManager: | ||
|
|
@@ -41,6 +41,9 @@ def main(skip_setup=False, integrations=[]): | |
| with BootstrapContextManager(skip_setup) as bootstrap: | ||
| working_dir = os.getcwd() | ||
| test_plugin = PluginTest() | ||
|
|
||
| util.show_containers_logs(["logstash-", "elasticsearch-", "elastic-agent-"]) | ||
|
|
||
| packages = integrations or INTEGRATION_PACKAGES_TO_TEST | ||
| for package in packages: | ||
| try: | ||
|
|
@@ -50,13 +53,7 @@ def main(skip_setup=False, integrations=[]): | |
| print(f"Test failed for {package} with {e}.") | ||
| failed_packages.append(package) | ||
|
|
||
| container = util.get_logstash_container() | ||
|
|
||
| # pretty printing | ||
| print(f"Logstash docker container logs..") | ||
| ls_container_logs = container.logs().decode('utf-8') | ||
| for log_line in ls_container_logs.splitlines(): | ||
| print(log_line) | ||
| util.show_containers_logs(["logstash-", "elasticsearch-", "elastic-agent-"]) | ||
|
|
||
| if len(failed_packages) > 0: | ||
| raise Exception(f"Following packages failed: {failed_packages}") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,30 @@ def call_url_with_retry(url: str, max_retries: int = 5, delay: int = 1) -> reque | |
| session.mount(schema, HTTPAdapter(max_retries=retries)) | ||
| return session.get(url) | ||
|
|
||
|
|
||
| def get_logstash_container() -> Container: | ||
| def show_containers_logs(container_prefixes): | ||
| client = docker.from_env() | ||
| return client.containers.get("elastic-package-stack-e2e-logstash-1") | ||
|
|
||
| containers = client.containers.list(all=True) | ||
| print(f"Available container names: {[c.name for c in containers]}") | ||
| matching_containers = [] | ||
| for container in containers: | ||
| if any(prefix in container.name for prefix in container_prefixes): | ||
| matching_containers.append(container) | ||
|
|
||
| if not matching_containers: | ||
| prefixes_str = ", ".join(container_prefixes) | ||
| print(f"No containers found with prefixes: {prefixes_str}") | ||
| return | ||
|
|
||
| for container in matching_containers: | ||
| # pretty printing with clear separators | ||
| separator = "=" * 80 | ||
| print(f"\n{separator}") | ||
| print(f"Container: {container.name}") | ||
| print(f"{separator}") | ||
| container_logs = container.logs().decode('utf-8') | ||
| for log_line in container_logs.splitlines(): | ||
| print(f" {log_line}") | ||
| print(f"{separator}\n") | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This gives us better visibility what happened with entire stack. |
||
|
|
||
| def run_or_raise_error(commands: list, error_message): | ||
| result = subprocess.run(commands, universal_newlines=True, stdout=subprocess.PIPE) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,7 +175,10 @@ void setupMock() { | |
|
|
||
| try (RestClient restClient = rcb.build()) { | ||
| final SSLHandshakeException ex = assertThrows(SSLHandshakeException.class, () -> restClient.performRequest(new Request("GET", "/"))); | ||
| assertThat(ex.getMessage(), stringContainsInOrder("fatal", "bad_certificate")); | ||
| assertThat(ex.getMessage(), allOf( | ||
| containsString("fatal"), | ||
| anyOf(containsString("bad_certificate"), containsString("certificate_required")) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In some hosts (mostly with recent builds), this test fails with the below error, looks like a JVM specific.
|
||
| )); | ||
| } | ||
| } | ||
|
|
||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.