Skip to content
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

Add system tests to elasticsearch package #4442

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Oct 11, 2022

What does this PR do?

This PR adds system tests to the Elasticsearch package

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

  • Run elastic-package stack up -v -d --version 8.5.0-SNAPSHOT
  • Thencd packages/elasticsearch && elastic-package build && elastic-package test system

Related issues

(cherry picked from commit f02544d517fbf57827bc43f46265896656e96adb)
@elasticmachine
Copy link

elasticmachine commented Oct 11, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-10-14T11:09:36.077+0000

  • Duration: 32 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 55
Skipped 0
Total 55

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Oct 11, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (5/5) 💚
Files 100.0% (9/9) 💚 2.783
Classes 100.0% (9/9) 💚 2.783
Methods 88.073% (96/109) 👎 -1.738
Lines 91.98% (562/611) 👍 0.513
Conditionals 100.0% (0/0) 💚

@crespocarlos crespocarlos changed the title Add system tests for elasticsearch package Add system tests to elasticsearch package Oct 11, 2022
@crespocarlos crespocarlos force-pushed the 4008-elasticsearch-package-system-tests branch 3 times, most recently from 3570a06 to 231b51f Compare October 12, 2022 11:25
@crespocarlos crespocarlos force-pushed the 4008-elasticsearch-package-system-tests branch 11 times, most recently from 1abd59b to 9d48135 Compare October 13, 2022 18:15
@crespocarlos crespocarlos force-pushed the 4008-elasticsearch-package-system-tests branch from 9d48135 to 1a540b9 Compare October 13, 2022 19:04
@elasticmachine
Copy link

elasticmachine commented Oct 13, 2022

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@@ -27,3 +36,10 @@ services:
command: "./generate-logs.sh"
volumes:
- ./scripts/generate-logs.sh:/generate-logs.sh
- "${SERVICE_LOGS_DIR}:/var/log"
- es_logs:/es_logs
volumes:
Copy link
Contributor Author

@crespocarlos crespocarlos Oct 14, 2022

Choose a reason for hiding this comment

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

Elasticsearch container must not be started with root user. With this in memory mount, log_generation container, which is logged in with root, is able to get the files generated by the elasticsearch container and copy them to ${SERVICE_LOGS_DIR}

@crespocarlos crespocarlos marked this pull request as ready for review October 14, 2022 08:44
@crespocarlos crespocarlos requested a review from a team as a code owner October 14, 2022 08:44
Copy link
Contributor

@matschaffer matschaffer left a comment

Choose a reason for hiding this comment

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

Not sure what a good "dev loop" for this stuff is. But these seem to take about 20 minutes to run and eventually I get 2 failures

--- Test results for package: elasticsearch - START ---
FAILURE DETAILS:
elasticsearch/gc default (variant: elasticsearch_8.5.0):
[0] parsing field value failed: field "process.pid"'s Go type, string, does not match the expected field type: long (field value: 172)
[1] parsing field value failed: field "process.pid"'s Go type, string, does not match the expected field type: long (field value: 191)
[2] parsing field value failed: field "process.pid"'s Go type, string, does not match the expected field type: long (field value: 209)
elasticsearch/slowlog default (variant: elasticsearch_8.5.0):
[0] parsing field value failed: field "elasticsearch.slowlog.id"'s Go type, <nil>, does not match the expected field type: keyword (field value: <nil>)


╭───────────────┬────────────────┬───────────┬────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────╮
│ PACKAGE       │ DATA STREAM    │ TEST TYPE │ TEST NAME                              │ RESULT                                                                                          │   TIME ELAPSED │
├───────────────┼────────────────┼───────────┼────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────┤
│ elasticsearch │ audit          │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │   50.42037067s │
│ elasticsearch │ cluster_stats  │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │  49.489491231s │
│ elasticsearch │ gc             │ system    │ default (variant: elasticsearch_8.5.0) │ FAIL: one or more errors found in documents stored in logs-elasticsearch.gc-ep data stream      │  53.643696827s │
│ elasticsearch │ index          │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │   54.83371928s │
│ elasticsearch │ index_recovery │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │   54.26436754s │
│ elasticsearch │ index_summary  │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │  57.360332617s │
│ elasticsearch │ ml_job         │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │ 1m16.96065921s │
│ elasticsearch │ node           │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │  58.722088277s │
│ elasticsearch │ node_stats     │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │  58.491270634s │
│ elasticsearch │ server         │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │  58.943940543s │
│ elasticsearch │ shard          │ system    │ default (variant: elasticsearch_8.5.0) │ PASS                                                                                            │  54.375799125s │
│ elasticsearch │ slowlog        │ system    │ default (variant: elasticsearch_8.5.0) │ FAIL: one or more errors found in documents stored in logs-elasticsearch.slowlog-ep data stream │  54.671515062s │
╰───────────────┴────────────────┴───────────┴────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────╯

I'll start poking around to see if I can figure out what's up. Maybe it's just full docker disk again.

@@ -0,0 +1,4 @@
variants:
elasticsearch_8.5.0:
ELASTIC_VERSION: 8.5.0-SNAPSHOT
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder if this should be 8.6.0-SNAPSHOT now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or both versions? Though it will take twice as much time to complete the test run.

Copy link
Contributor

Choose a reason for hiding this comment

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

yikes

@crespocarlos
Copy link
Contributor Author

crespocarlos commented Oct 19, 2022

@matschaffer, It unfortunately takes a big chunk of time to complete.

Regarding the error above, did you start a clean elastic-package stack? In the slowlog pipeline, we explicitly tell it to remove the slowlog.id when it comes with a null value. And for the process.pid it's also explicitly converted to long in the gc ingest pipeline.

Which makes me wonder whether your elastic-package stack had the Filebeat version of the pipelines installed when the tests ran. If that's the case, I think fleet for some reason didn't replace them or picked up Filebeat's pipelines instead. If that's true, we may have problems. I'll try to reproduce this.

@klacabane
Copy link
Contributor

I think most time is spent setting and tearing down the _dev docker-compose, as well as enrolling an agent with the test's configuration for each data stream. There's maybe a way to provide a single test configuration so all data stream's are collected in a single run, but I can't see any notes on that in the documentation

@crespocarlos
Copy link
Contributor Author

crespocarlos commented Oct 19, 2022

I think most time is spent setting and tearing down the _dev docker-compose, as well as enrolling an agent with the test's configuration for each data stream. There's maybe a way to provide a single test configuration so all data stream's are collected in a single run, but I can't see any notes on that in the documentation

That would be nice, because the datastream is always deleted after the tests runs. But by looking at the elastic-package system test code, the runner always creates and destroys the container on each run

@crespocarlos
Copy link
Contributor Author

crespocarlos commented Oct 20, 2022

@matschaffer , there are 2 possible explanations:
1 - My testing steps didn't mention that you had to run elastic-package build, so maybe you had an old build on your env which was used when you ran the tests.
2 - If you build the package, package registry container could still be looking at an old build, if you either didn't restart the elastic package stack completely or didn't run elastic-package stack up -v -d --services package-registry

@crespocarlos crespocarlos added Integration:elasticsearch Elasticsearch Team:Infra Monitoring UI - DEPRECATED Label for the Infrastructure Monitoring UI team. - DEPRECATED - Use Team:obs-ux-infra_services labels Oct 27, 2022
@klacabane
Copy link
Contributor

LGTM - we can reach out to the ecosystem team to investigate ways to make the system tests cheaper to run as this will become increasingly problematic if we add variants

@crespocarlos crespocarlos merged commit bc5b3e0 into elastic:main Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:elasticsearch Elasticsearch Team:Infra Monitoring UI - DEPRECATED Label for the Infrastructure Monitoring UI team. - DEPRECATED - Use Team:obs-ux-infra_services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Stack Monitoring] Add system tests
4 participants