Commit graph

644 commits

Author SHA1 Message Date
Paul Tavares
807856abd2
[Security Solution][Endpoint] Combine the Endpoint management cypress test suites into a single configuration/run (#166757)
## Summary

- Combines the `endpoint` and `mocked_data` tests suites so that they
run from the same cypress configuration/run buildkite setup
- Moved test files from the `endpoint/` and `mocked_data/` directories
into new sub-directories that more closely describe the set of tests
they contain
- The `security_solution/package.json` file was updated so that the
following `scripts` will now output a warning indicating that command is
no longer valid:
    - `cypress:dw:endpoint`
    - `cypress:dw:endpoint:run`
    - `cypress:dw:endpoint:open`


The following npm/yarn commands remain available for running tests
locally:

```shell
yarn --cwd=x-pack/plugins/security_solution cypress:dw:open
``` 

```shell
yarn --cwd=x-pack/plugins/security_solution cypress:dw:run
```


New test file struncture:

<img width="415" alt="image"
src="0cb4bc76-b434-4219-b73e-508645201a81">
2023-09-20 14:38:29 -04:00
Maxim Palenov
bd5e15c22c
[Security Solution] Extend Flaky runner 's config to run Serverless Cypress tests (#166783)
## Summary

This PR extends Flaky test runner's config to be able to run Serverless Cypress tests.

[Serverless Security Solution Flaky test run](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3189)
2023-09-20 07:09:32 -07:00
Gergő Ábrahám
aa36fe67ae
[Defend Workflows] Add tags for mocked and real Endpoint Cypress tests for Serverless (#165094)
## Summary

- introduces tags for [Defend Workflows] cypress tests (similarly to
https://github.com/elastic/kibana/pull/162698)
- adds scripts to Security Solution:
  - `cypress:dw:serverless:open` and `:run`
  - `cypress:dw:endpoint:serverless:open` and `:run`
- adds CI jobs to run these scripts
- so far most of the expected tests got both `@serverless` and
`@brokenInServerless` tests, because of other issues to be solved,
- one test is able to run against serverless:
`x-pack/plugins/security_solution/public/management/cypress/e2e/mocked_data/policy_details.cy.ts`
2023-09-20 10:36:11 +02:00
Gloria Hornero
dd4708414a
Upgrading cypress to 12.17.4 (#165869)
Co-authored-by: Yuliia Naumenko <jo.naumenko@gmail.com>
Co-authored-by: Thomas Watson <w@tson.dk>
Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-19 10:15:53 -07:00
Nathan Reese
691311ce7c
[maps] fix Air-gapped enviroment hitting 400 error loading fonts for layer (#165986)
Closes https://github.com/elastic/kibana/issues/165974

The root cause of the problem is calling `basePath.prepend` on a path
without a leading `/`. Maps is not consistent with path constants. Some
have leading `/` while others do not. To resolve the issue, this PR
updates all path constants to consistently have leading `/`.

PR adds functional test runner with `map.includeElasticMapsService:
false` to ensure maps is tested without EMS enabled to catch future
regressions.

### Test instructions
* set *map.includeElasticMapsService: false* in kibana.dev.yml
* install sample data set
* create new map with documents layer
* Configure label styling
* Verify layer is displayed with labels

<img width="500" alt="Screen Shot 2023-09-13 at 6 26 23 AM"
src="44d12e87-9b80-424c-9bc9-126b373bdf18">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-13 10:06:05 -06:00
Tomasz Ciecierski
c7e360bcd9
[EDR Workflows] Bring back artifacts, fix tests (#166341) 2023-09-13 15:36:33 +02:00
Jon
09e8e9a9f2
[ci] Merge test_serverless into ftr configs (#159607)
This moves all FTR and cypress based serverless tests into the default
test pipeline.  By moving these tests, failures will
now fail pull request and on-merge pipelines.
2023-09-13 11:15:55 +02:00
Lisa Cawley
bfa334c500
Automate serverless screenshots (#165524)
Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
2023-09-12 16:35:34 +02:00
Luke Elmers
23e17ab5dd
Rename changed QA serverless pipeline name. (#166028) 2023-09-08 09:30:10 +02:00
Luke Elmers
2558c7f9b8
Only trigger manual tests phase in QA after all other steps have passed. (#165981)
Co-authored-by: Ramon Butter <ramon.butter@elastic.co>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2023-09-08 09:28:54 +02:00
Quynh Nguyen (Quinn)
4eb45e67c0
[ML] Add new performance journey for Index data visualizer (#164787)
## Summary

This PR adds a performance journey test for the Index data visualizer,
using the Kibana TSDB logs.

To run test:
```
node scripts/run_performance.js --journey-path x-pack/performance/journeys/tsdb_logs_data_visualizer.ts --skip-warmup
```


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co>
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
2023-09-07 14:40:42 -07:00
Tiago Costa
8f22eb15fe
chore(NA): reduce parallelism number on Serverless Security Cypress Tests (#165906)
This PR reduces the parallel number of workers that will run the
Serverless Security Cypress Tests for now. As we have skipped some
serverless tests that were flaky we don't need as much workers as
before. As soon as we see those pipeline times increasing we can restore
the number of workers.
2023-09-07 17:04:25 +01:00
Maxim Palenov
369d2fe367
[Security Solution] Fix a build step when there are no tests to execute (#165929)
## Summary

Fixes failed build steps when there are no tests to execute and hence no
reports.

## Details

Despite this [PR](https://github.com/elastic/kibana/pull/165824) fixes
tests failure when there are no reports but `yarn junit:merge` tries to
convert them to junit format the problem is partially stays as `Failed
Test Reporter` runs for every build step meaning also for successful
build steps. We don't need to handle failed test reports for successful
build steps. There are cases when there are no tests to run so Cypress
doesn't produce reports and nothing is converted to junit format so
`Failed Test Reporter` fails and causes a build step to fails. It could
be solved by defining an environment variable
`DISABLE_MISSING_TEST_REPORT_ERRORS=true` but we need to make sure
reports exist for failed tests. Taking this into account we can rely on
`BUILDKITE_COMMAND_EXIT_STATUS` to avoid running `Failed Test Reporter`
if the build step successed.

One may ask why don't skip `Upload Artifacts` too. We may need some
build artifacts for successful build steps.

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2023-09-07 17:02:16 +01:00
Isaac Karrer
243b1e93a2
notify mission control (#165977)
## Summary

Notify mission control on any releases.
2023-09-07 08:07:05 -07:00
Jiawei Wu
456f47f3ab
[RAM] Introduce maxScheduledPerMinute rule circuit breaker and route (#164791)
## Summary
Resolves: https://github.com/elastic/kibana/issues/162262

This PR is the backend changes to add a circuit breaker
`xpack.alerting.rules.maxScheduledPerMinute` to both serverless and
other environments that limits the number of rules to 400 runs / minute
and 10000 runs / minute, respectively. There will be another PR to
follow this one that gives the user UI hints when creating/editing rules
that go over this limit.

This circuit breaker check is applied to the following routes:
- Create Rule
- Update Rule
- Enable Rule
- Bulk Enable Rule
- Bulk Edit Rule

Also adds a new route: `/internal/alerting/rules/_schedule_frequency` to
get the current total schedules per minute (of enabled rules) and the
remaining interval allotment.

### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
Co-authored-by: Xavier Mouligneau <xavier.mouligneau@elastic.co>
2023-09-06 09:13:36 -07:00
Maxim Palenov
9f2f739edf
[Security Solution] Prevent junit tranformation command from breaking a build step (#165824)
## Summary

This PR implements a temporary fix to prevent `yarn junit:merge` command
from breaking a build step by returning non zero code. `yarn
junit:merge` fails in case if it can't find reports or folders it
operates on weren't created beforehand.
2023-09-06 09:41:55 -05:00
Tomasz Ciecierski
630a95bc10
[Defend Workflows] Adjust headers in fleet api (#165823) 2023-09-06 15:47:47 +02:00
Alex Szabo
015b910de2
[Ops] Run kibana quality gate suites (#165346)
## Summary
Sets up quality gate triggering in Kibana. The tests are mostly
triggering external pipelines and relying on their results. Here's an
example run:
https://buildkite.com/elastic/kibana-tests/builds/28#job-018a69a6-c860-405e-ab2b-bce2aed07df3

According to [this
doc](https://docs.google.com/document/d/15rx2Z-soL20An0nBUcXX0o_HHf1OU_IgrHXgz20NndI/edit)
many of the quality gates are really required for the QA->Staging
promotion step.

Most of the tests are in the QA stage: 
 - [fleet smoke tests](https://buildkite.com/elastic/fleet-smoke-tests)
- ~~[QAF RAC load
tests](https://buildkite.com/elastic/appex-qa-rac-alert-load)~~ Removed,
see https://github.com/elastic/kibana/pull/165346#discussion_r1316822164
- [QAF serverless
tests](https://buildkite.com/elastic/appex-qa-kibana-serverless-ftr-tests)
- [control plane QA smoke
tests](https://buildkite.com/elastic/ess-k8s-qa-e2e-tests-daily)
- [security solution
tests](.buildkite/scripts/pipelines/security_solution_quality_gate/pipeline.sh)
+ manual check for confirming manual tests
 - Manual confirmation 👍

Staging has: 
- [control plane staging smoke
tests](https://buildkite.com/elastic/ess-k8s-staging-e2e-tests)
 - Manual confirmation 👍

Production has:
- [control plane production smoke
tests](https://buildkite.com/elastic/ess-k8s-production-e2e-tests)
 - Manual confirmation 👍

### Quirks
- ~~`SKIP_KIBANA_HOOKS=1` needs to be set from the triggering job~~
Split into https://github.com/elastic/kibana/pull/165597
- The pipeline can only be tested from the non-fork, `elastic/kibana`
repo's branches (because buildkite doesn't see forks' branches)
- Soft fails added, to not block the release pipeline in case we still
need to adjust/work on some unstable tests

Reference:
https://docs.google.com/document/d/15rx2Z-soL20An0nBUcXX0o_HHf1OU_IgrHXgz20NndI/edit
Depends on: #165009 
Closes: https://github.com/elastic/kibana-operations/issues/10

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Thomas Watson <watson@elastic.co>
2023-09-06 13:22:43 +02:00
Tiago Costa
5a206e2c2e
chore(NA): reduce parallelism number on Serverless Security Cypress Tests (#165681)
This PR reduces the parallel number of workers that will run the
Serverless Security Cypress Tests as at least for now I don't think we
need `16`.
2023-09-05 18:58:43 +01:00
Maxim Palenov
c54acc3b1b
[Security Solution] Fix osquery Cypress CI build (#165677)
## Summary

It fixes Osquery Cypress CI build step by rolling back the changes.

## Details

https://github.com/elastic/kibana/pull/165541 broke Osquery build step
by running junit transformation command while Osquery Cypress tests
don't produce any reports. The fix just removes junit transformation
command.
2023-09-05 12:12:04 -05:00
Stavros Kroustouris
5cb092d583
TLS-626 make sure that all the gpctl triggers are running the tests (#165594)
## Summary

After chatting with the team, i realized that
https://github.com/elastic/kibana/pull/165334 did not include the file
this PR is updating.


## Note
Another approach would be to keep the pipeline triggers as they are, but
make sure the e2e tests have been run in parallel with any other tests
during the CI process. This would potentially shorten the CI times since
the e2e tests take around 40 minutes to run.
2023-09-05 07:23:27 -07:00
Ramon Butter
a53e3055c0
change quality gates notifications (#165646) 2023-09-05 11:19:17 +02:00
Maxim Palenov
deed5e4679
[Security Solution] Fix junit report transformation (#165541)
**Fixes:** https://github.com/elastic/kibana/issues/165546

## Summary

This PR fixes junit report transformation for Security Solution build steps (Cypress writes reports in `mochawesome` format and `yarn junit:transform` transforms it to junit format).

## Details

After refactoring it turned out `yarn junit:merge` was moved from `cypress:*` yarn scripts to build step `*.sh` files in `.buildkite/scripts/steps/functional` folder. This way a command to run Cypress tests changed from

```sh
yarn cypress:run:ess
```

to

```sh
yarn cypress:run:ess; status=$?; yarn junit:merge && exit $status
```

In first case any test failure do not lead to early exist and all following commands are executed as yarn runs scripts without preserving shell settings. In the second case failing tests lead to `yarn cypress:run:ess` exit with non-zero exit code so the shell script exits immediately without giving a chance for `yarn junit:merge` to execute.

This problem is solved by disabling early exit on error via `set +e`.

On top of that using of `artifact_paths` config option is redundant as [post command script](https://github.com/elastic/kibana/blob/main/.buildkite/scripts/lifecycle/post_command.sh#L16) upload build artefact via a bildkite agent.

#### [Failed build example](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3049#_)
2023-09-05 07:40:32 +02:00
Alex Szabo
ee986415c8
[Ops] Fix typos in bk pipeline stubs (#165617)
## Summary
In the created stubs, some of the buildkite steps used `agent` instead
of `agents`, this failed the steps.
This PR fixes these typos.

see:
https://buildkite.com/elastic/kibana-tests/builds/20#018a6109-c878-489d-a4e4-ad4db1e75e87
2023-09-04 18:58:26 +01:00
Alex Szabo
0edc23e02a
[Ops] Skip buildkite hooks for non kibana jobs (#165597)
## Summary

Kibana's build jobs work on a different subset of executors than the
buildkite pipelines defined in `catalog-info.yaml`.

The former jobs require a set of `pre_command` / `post_command` steps to
prepare the jobs for building/testing kibana.
The latter don't have access rights to certain vault secrets (and
possibly other missing config from the Kibana world), but for now,
they're also not building Kibana, they just trigger other jobs, so we
can just skip the problematic hooks.

~~A probably good indicator I found for deciding whether we need the
kibana-related `pre_command` is the
`BUILDKITE_AGENT_META_DATA_AGENT_MANAGER` flag, that's set to `"kibana"`
in the case of the kibana executors.~~

We can try to match on the agent names for the CI-systems agents. They
seem to be starting with `bk-agent`.

This should allow for the
[kibana-tests](https://buildkite.com/elastic/kibana-tests) job to run.

Split from: https://github.com/elastic/kibana/pull/165346

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2023-09-04 09:29:16 -07:00
Yngrid Coello
4b4ba09f25
[Logs onboarding] e2e tests for SystemLogs onboarding (#164989)
Relates to https://github.com/elastic/kibana/issues/164022.
2023-09-04 05:53:35 -07:00
Jon
e52dd715ca
[ci] Stricter check on pre_command skip (#165519)
When buildkite-agent is uploading a pipeline we can skip setting up our
node environment. This stricter check avoids matching on similarly named
steps, e.g. our storybooks upload.
2023-09-01 14:42:14 -05:00
Brandon Kobel
75a23c86c5
Echoing out BUILDKITE_COMMAND (#165506) 2023-09-01 14:26:24 -04:00
Brandon Kobel
39ef9bc81c
Skipping pre-command when running the Upload pipeline (#165505)
Context: https://elastic.slack.com/archives/C5UDAFZQU/p1693587045671319
2023-09-01 14:15:49 -04:00
Stavros Kroustouris
2dd713c505
TLS-626 Trigger promote with e2e tests (#165334)
## Summary
This PR calls the pipeline introduced on
https://github.com/elastic/gpctl/pull/167 which calls the e2e tests
before updating serverless gitops.

The previous change which was introduced on the commits below, used
gpctl to update the image tags for kibana on the controller. This change
resulted in skipping the part where the e2e tests were being run 😬


bf148fb35f

3cfbf24190

The present PR fixes this, by using the new pipeline which includes the
e2e tests introduced on https://github.com/elastic/gpctl/pull/167
2023-09-01 15:02:38 +02:00
Jean-Louis Leysens
bc9b6f8b16
[Test] Unskip serverless ES jest integration smoke test (#165316)
## Summary

Unskip the `smoke` test we added for serverless jest integration and
update the root utilities.
2023-08-31 17:14:43 -07:00
Isaac Karrer
bc866a7f96
reverse which config we call to keep locking working (#165351)
## Summary

The config does not propagate to downstream workflow jobs in all cases
so things break if we don't use the default. Therefore we will make dev
the exception.

Update the gpctl config we reference in the gitops repo. The default
config needs to be the promotion workflow and dev needs to be separate
otherwise other promotion infrastructure breaks since it does not know
to look for the overridden config.
https://github.com/elastic/serverless-gitops/pull/688

Slack: https://elastic.slack.com/archives/C9PPG4EJH/p1693480365606699
2023-08-31 15:55:10 -05:00
Davis McPhee
b4bfb2a2dd
[Data Discovery] Run example plugin functional tests in Serverless (#163411)
## Summary

> [!IMPORTANT]  
> These tests currently do not run in "real" Serverless and only run in
"local" Serverless (what we use in CI). Additional work will need to be
done to allow these tests to be run in an actual Serverless environment,
since they required `config.ts` changes which are only loaded when
running locally.

This PR copies the Data Discovery example plugin functional tests to
`test_serverless` and adds support for running them against the Search
project.

It also adds support for running functional tests against example
plugins in general in Serverless ("local" Serverless only currently).

In the future these should run as deployment-agnostic tests, but support
does not yet exist (see #161574), so in the meantime they've been
duplicated and modified in place. I've left `TODO` comments where test
files have been modified so we know what needs to be addressed once they
are converted to deployment-agnostic tests.

Part of #162347.

### Checklist

- [ ] ~Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~
- [ ]
~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] ~Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard
accessibility](https://webaim.org/techniques/keyboard/))~
- [ ] ~Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~
- [ ] ~This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
2023-08-31 10:23:05 -03:00
Isaac Karrer
581b7f4327
pipeline for serverless kibana release (#165009)
## Summary

Adds a pipeline that will trigger the promotion and QG for kibana
through qa -> staging -> production whenever the tag which [matches the
regex](https://regex101.com/r/tY52jo/1) is created.

Sibling PR [here](https://github.com/elastic/serverless-gitops/pull/661)
that defines `main/gen/gpctl/kibana/tagged-release.yaml`

The meat of the PR is the regex.

---------

Co-authored-by: Thomas Watson <w@tson.dk>
Co-authored-by: Alex Szabo <delanni.alex@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-08-31 08:08:01 -05:00
Felix Stürmer
ad59308b24
[Log Explorer] Convert log explorer profile into standalone app (#164493)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>
2023-08-31 14:18:44 +02:00
Brad White
06ebc3120c
ESS support for FTR serverless tests. SSL support in kbn/es. kbn/es DX improvements. (#162673)
Closes #162593
Closes #163939 
Closes #162625

The original intention of this PR was to add FTR support for ESS.
However the scope increased as that also required adding SSL support due
to tests failing from disabled `security` and no authentication.
Additionally, after using serverless in `kbn/es` extensively for this,
there was a bit of friction in regards to DX.

## Summary
- Switch `x-pack/test_serverless` FTR to use ES serverless instead of
(stateful) snapshot
- Adds SSL support to Docker and Serverless in `kbn/es`
- Adds `port` option override
- Adds `teardown` option to kill running nodes if the process exits
without shutdown
- Adds `kill` option to kill running nodes on startup if detected
- Adds `--esFrom serverless` to FTR CLI
- Adds `files` option to mount extra files into containers
- For serverless, automatically attach to first node with `docker logs
-f es01` on startup for better DX.
- Added `background` flag to not attach `logs`.
- Adds graceful shutdown for ESS cluster
- Separate `docker pull` from `run` for better logging, ensures latest
image and stops multiple pulls of the same image occurring in parallel
- Align (most) default settings for ES serverless with `gradlew`
[settings](https://github.com/elastic/elasticsearch-serverless/blob/main/serverless-build-tools/src/main/kotlin/elasticsearch.serverless-run.gradle.kts#L8)
- Fixes Docker bind mount permissions in CI
- Fixes issue where `esFrom` would default to `snapshot` and override
FTR config settings.

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

## Related Issues for Skipped Tests
Security Threat Hunting: #165135
Observability: #165138
Response Ops: #165145

---------

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
2023-08-30 13:28:29 -07:00
Patryk Kopyciński
779ef9e901
[security_solution] Improve Cypress burn logic (#165130)
## Summary

Add `burn` scripts to `package.json` to simplify the process of testing
spec files locally
2023-08-30 18:05:51 +02:00
Alex Szabo
8ddb762746
[Ops] Improve serverless_ftr.sh result output (#164966)
## Summary
The FTR serverless pipeline's output can be confusing, because in case
any of the configs fail, the error log is always attached to the last
collapsing block (thus making devs think it was the last block that was
erroneous).

This PR adds an output message after the configs are ran, and separates
the log from the last run's logs.

- chore: Add result logging for serverless_ftr.sh with a new collapsing
block to avoid confusion

Was:
<img width="1086" alt="Screenshot 2023-08-28 at 16 08 43"
src="46721879-8add-49a2-8448-b9ed40ac8bc0">

Would be:
<img width="1079" alt="Screenshot 2023-08-28 at 16 08 20"
src="3eaf7f2b-7fc8-4777-81e3-1c21ec57faaa">
2023-08-28 18:28:36 +02:00
Dmitrii Shevchenko
2171ecc719
[Security Solution] Initial migration of API endpoints to OpenAPI and code generation (#164482)
**Part of: https://github.com/elastic/security-team/issues/6726**

## Summary

Migrates the prebuilt rules and timelines status API route schema to
OpenAPI. This is exploratory work to assess the level of effort required
to migrate API route schemas from `io-ts` to `zod` generated by OpenAPI
codegen.

**Summary of the changes:**

- Added a CI job that runs code generation in Security Solution and
comments change if there are any.
- Migrated the `/api/detection_engine/rules/prepackaged/_status` route
to use generated `zod` schemas
- Updated schema tests
- Adjusted the code generator templates to handle `strict` schemas,
i.e., schemas that do not allow any extra params
- Updated the error transformation code to work with zod errors.
Validation errors are converted to string representations, like the
following:
<img width="627" alt="image"
src="93002573-972f-42e1-901d-01a19937f568">
2023-08-25 20:01:31 +02:00
Dzmitry Lemechko
4552c6e3b7
[tags] add performance journey to track CRUD operations on listing page (#164537)
## Summary

This PR adds single user performance journey to track CRUD operations on
Tags listing page:
- get all tags on initial loading
- create a new tag 
- update the tag
- delete the tag
- bulk delete (first 20 tags)

flaky-test-runner 25x:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2966

Added visualisations to monitor metrics, most operations take <1 second
<img width="523" alt="image"
src="f4c14e49-edf6-4fff-9f31-30b8a67970e9">

Since bulk delete takes ~20 sec, I put it on the separate visualisation
<img width="523" alt="Screenshot 2023-08-23 at 18 19 46"
src="467983f8-f8eb-486a-8e27-beac0d9b1f37">


dd0473ac-826f-5621-9a10-25319700326e?_g=h@3b0c329

To run locally: `node scripts/functional_tests.js --config
x-pack/performance/journeys/tags_listing_page.ts`

Note: this journey is compatible to be executed on Serverless project

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-25 14:46:32 +02:00
Patryk Kopyciński
4180a1a105
[security_solution] Fix @grep tags in Cypress (#164644)
## Summary

`@cypress/grep` is just reading the file as text, so it's not capable of
evaluating the variables, because of that, today we are running all the
spec files, and that means that we are setting up a new stack just to
stop it a few seconds later after grep skips the spec file

https://github.com/cypress-io/cypress/blob/develop/npm/grep/src/plugin.js#L117

With variable:
<img width="1219" alt="Zrzut ekranu 2023-08-23 o 23 06 30"
src="97b6fdaa-a03a-4a4f-bbdc-97da8e1788ce">

With string:
<img width="2074" alt="Zrzut ekranu 2023-08-23 o 23 06 04"
src="1f48d20a-3a1a-4ded-aa47-493781a4758b">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-25 13:22:04 +01:00
Isaac Karrer
f10b15afc5
Qx 282 touchup qg (#164643)
## Summary

The wrong file path was being given for the pipeline, this fixes that.  

Also, the [serverless release end to end
workflow](https://docs.google.com/document/d/15rx2Z-soL20An0nBUcXX0o_HHf1OU_IgrHXgz20NndI/edit)
calls out some things that I missed on the first pass. Please refer to
the "Kibana Release required testing" table.
2023-08-24 08:48:31 -05:00
Patryk Kopyciński
05cfa1ad5b
Fix Kibana fail to startup in Cypress (#164480)
## Summary
 
- remove duplicated buildkite pipeline steps
- remove concurrency from parallel that was causing flakiness
- cleanup package.json scripts

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2023-08-24 15:36:27 +02:00
Jon
464f908ac3
[ci] Fix on-merge labels (#164459)
Currently some on merge steps fetch labels from the merged pull request
by parsing the first line of the commit message. This convention usually
works, but it overlaps with the convention of skipping test suites
linking to an issue instead of a pull request. Errors are thrown when a
step attempts to pull metadata from an unset value.

This sets a default value of an empty string if the label metadata is
unset and cleans up the log message when an error occurs.

Example error:
https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/5821#018a1d62-fbd2-486d-afe3-9a448449bbf7/257-258
2023-08-24 08:31:43 -05:00
Jiawei Wu
ba96a720f1
[RAM] Make Global Event Log Shareable (#163668)
## Summary
Resolves: https://github.com/elastic/kibana/issues/161788

Makes the global event log shareable. Plus some refactors like
converting the `rule_event_log_list_table` fetch to use React Query.

Also, fixed a bug with the `rule_status_panel` where we did not refresh
if the parent component refreshed.

### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-23 09:20:34 -07:00
Tomasz Ciecierski
054cdbaf1e
[EDR workflows] Osquery serverless tests (#163795) 2023-08-23 11:53:14 +02:00
Tim Sullivan
deb64c19cf
Reporting/fix visual warning test (#164383)
## Summary

Closes https://github.com/elastic/kibana/issues/135309

This PR eliminates a skipped functional test by replacing the test
coverage with unit tests.

*
`x-pack/plugins/screenshotting/server/screenshots/screenshots.test.ts`:
ensures that waiting too long for the URL to open will return the
expected error message
*
`x-pack/plugins/screenshotting/server/browsers/chromium/driver.test.ts`:
ensures that when the screenshot capture method is passed an error
message, that error message is injected into the screenshot

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-22 09:20:40 -07:00
Isaac Karrer
58334b54ac
Kibana QualityGate Scaffold (#163831)
The main question is here did I get the github team names correct for
fleet and security? Are there any other groups I am missing who will
have quality gates they want to see execute on every kibana release?

- The PR which registered the repo and controls who can write secrets to
vault was merged
[here](https://github.com/elastic/catalog-info/pull/488/files)
- Quality gate registration with argo deploy pipeline
[here](https://github.com/elastic/serverless-gitops/pull/586). Should
merge after this and pipelines are working.
- [this one](https://github.com/elastic/catalog-info/pull/485/files)
merges last and tells terrazzo about the catalog-info.yaml file with our
pipeline. Other pipelines should be migrated over but are not included
here.


Rel: https://github.com/elastic/ingest-dev/issues/2201
Rel: https://elasticco.atlassian.net/browse/QX-282

---------

Co-authored-by: Ramon Butter <ramon.butter@elastic.co>
2023-08-22 14:30:08 +02:00
Dzmitry Lemechko
7ece4e5df3
[FTR] Move serverless tests depending on feature flag to its own config file (#163929)
## Summary

It seems beneficial to have feature flag tests in a separate test config
file
 - tests are still run on Kibana CI automatically
- tests are not run on MKI projects automatically, but you can deploy
custom project and run tests via feature flags config

All the feature flags within the same project should be places in the
same config to make sure there is no arguments conflict.
When the flag is moved to the yml configuration, we can rely on Kibana
CI and manually triggered deployment to make sure projects are
functioning correctly.

---------

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
2023-08-22 05:09:41 -07:00
Patryk Kopyciński
aaedb2d449
[security_solution] Update serverless buildkite pipeline (#164155)
## Summary

Align buildkite pipelines between ess and serverless
2023-08-17 17:41:09 +02:00