Commit graph

5 commits

Author SHA1 Message Date
Kevin Lacabane
e1579c8f4a
[Stack Monitoring] baseline kibana api tests for package and metricbeat data (#153184)
## Summary

Part of https://github.com/elastic/kibana/issues/148303

Port kibana api tests to the
[monitoring_api_integration](https://github.com/elastic/kibana/tree/main/x-pack/test/monitoring_api_integration)
suite. This reimplements all the existing tests with fresh data.

See [flaky test
run](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2002)
2023-03-20 13:49:20 +01:00
Kevin Lacabane
ab7c879c23
[Stack Monitoring] baseline logstash api tests for package and metricbeat data (#152575)
## Summary

Closes https://github.com/elastic/kibana/issues/151158
Part of https://github.com/elastic/kibana/issues/148303

Port logstash tests to the
[monitoring_api_integration](https://github.com/elastic/kibana/tree/main/x-pack/test/monitoring_api_integration)
suite. This reimplements all the existing tests (plus missing ones for
the pipeline api) with fresh data.

See [flaky test
run](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1982)
2023-03-08 14:26:05 +01:00
Kevin Lacabane
d9adcca543
[Stack Monitoring] implement baseline elasticsearch api tests for package and metricbeat data (#149161)
### Summary

Part of https://github.com/elastic/kibana/issues/148303
Closes https://github.com/elastic/kibana/issues/146067
Closes https://github.com/elastic/kibana/issues/146068

I investigated the failing tests but couldn't get to the root cause
quickly enough so I took the opportunity to port the tests to the
[monitoring_api_integration](https://github.com/elastic/kibana/tree/main/x-pack/test/monitoring_api_integration)
suite. This reimplements all the existing tests (plus missing ones for
the `ml_jobs` api) with fresh data.
By using the new testing approach we can remove the archived mappings
which greatly reduce execution times.

### Testing
- The suite was executed against by the [flaky test
runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1804)
multiple times with no failures
- Test data is bundled in two archives (one for metricbeat and one for
package data) and can be loaded to verify their content: `node
scripts/es_archiver.js load
x-pack/test/monitoring_api_integration/archives/elasticsearch/single_node/(package|metricbeat)
--es-url=http://elastic:changeme@localhost:9200
--kibana-url=http://elastic:changeme@localhost:5601`

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-30 17:01:00 +01:00
Kevin Lacabane
870f79df8c
[Stack Monitoring] support entsearch package (#148668)
### Summary

Update stack monitoring to read from data streams created by the
[enterprisesearch
package](https://github.com/elastic/integrations/pull/4926)

### Testing
- build [enterprisesearch
package](https://github.com/elastic/integrations/pull/4926)
- start stack: `elastic-package stack up -v -d --version
8.7.0-SNAPSHOT`; make sure your image contains [this
change](https://github.com/elastic/elastic-agent/pull/2121)
- start enterprisesearch service: `elastic-package service up -v`
- install elasticsearch integration with variables
- `hosts: http://host.docker.internal:9201; username: elastic; password:
changeme`
- install enterprisesearch integration with variables
- `hosts: http://host.docker.internal:3002; username: elastic; password:
changeme`
- connect [local
kibana](2d893bf40b/x-pack/plugins/monitoring/dev_docs/how_to/work_with_packages.md (connecting-a-local-kibana))
- navigate to Stack Monitoring on the local kibana, enterprise search
section shows up with populated graphs

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-30 13:43:13 +01:00
Kevin Lacabane
5c9df67e8d
[Stack Monitoring] Beats package integration tests (#147755)
### Summary

**Sets up the foundations for
https://github.com/elastic/kibana/issues/146000**
- created a new test server under
`x-pack/test/monitoring_api_integration/` that allows loading of
packages at kibana startup
- a test runner utility which is a simple for loop executing the
supplied test twice, one time with `metricbeat` data and a second time
with `package` data
- a utility that allows transformation of package data into metricbeat
data

**Adds API tests for the beats package**
- created a test case for each API exposed
- removed the duplicates from
`x-pack/test/api_integration/apis/monitoring`

-----

_See the included
[README](b55de5c1cc/x-pack/test/monitoring_api_integration/README.md)
for additional details_

This directory defines a custom test server that provides bundled
integrations
packages to the spawned test Kibana. This allows us to install those
packages at
startup, with all their assets (index templates, ingest pipelines..),
without
having to reach a remote package registry.
With the packages and their templates already installed we don't have to
provide
the static mappings in the tests archives. This has the benefit of
reducing our
disk footprint and setup time but more importantly it enables an easy
upgrade path
of the mappings so we can verify no breaking changes were introduced by
bundling
the new versions of the packages.

_Note that while Stack Monitoring currently supports 3 collection modes,
the tests
in this directory only focus on metricbeat and elastic-agent data. Tests
for legacy
data are defined under `x-pack/test/api_integration/apis/monitoring`._

Since an elastic-agent integration spawns the corresponding metricbeat
module under
the hood (ie when an agent policy defines elasticsearch metrics data
streams,
a metricbeat process with the elasticsearch module will be spawned), the
output
documents are _almost_ identical. This means that we can easily
transform documents
from a source (elastic-agent) to another (metricbeat), and have the same
tests run
against both datasets.

Note that we don't have to install anything for the metricbeat data
since the mappings
are already installed by elasticseach at startup, and available at
`.monitoring-<component>-8-mb`
patterns. So we are always running the metricbeat tests against the
latest version of
the mappings.
We could have a similar approach for packages, for example by installing
the latest
packages versions from public EPR before the test suites run, instead of
using pinned
versions. Besides the questionable reliance on remote services for
running tests,
this is also dangerous given that packages are released in a continuous
model.
This means that whenever the test suite would execute against the latest
version
of packages it would be too late, as in already available to users.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-03 16:20:17 +01:00