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

ES Serverless support for FTR serverless tests. SSL support in kbn/es. kbn/es DX improvements. #162673

Merged
merged 235 commits into from
Aug 30, 2023

Conversation

Ikuni17
Copy link
Contributor

@Ikuni17 Ikuni17 commented Jul 28, 2023

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
  • Fixes Docker bind mount permissions in CI
  • Fixes issue where esFrom would default to snapshot and override FTR config settings.

Checklist

Related Issues for Skipped Tests

Security Threat Hunting: #165135
Observability: #165138
Response Ops: #165145

@Ikuni17 Ikuni17 self-assigned this Jul 28, 2023
@Ikuni17 Ikuni17 added WIP Work in progress release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting skip-ci and removed skip-ci labels Jul 28, 2023
Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

LGTM for the Threat Hunting Investigations team

Copy link
Contributor

@e40pud e40pud left a comment

Choose a reason for hiding this comment

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

DE changes LGTM. Left couple questions

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

LGTM! 🥇

@patrykkopycinski patrykkopycinski requested review from a team and removed request for a team August 30, 2023 16:01
patrykkopycinski and others added 3 commits August 30, 2023 18:05
…-es-serverless-ftr

# Conflicts:
#	.buildkite/pipelines/pull_request/defend_workflows.yml
#	x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts
@elastic elastic deleted a comment from kibana-ci Aug 30, 2023
Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

ResponseOps changes LGTM

@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 30, 2023

💔 Build Failed

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/dev-utils 24 25 +1
@kbn/es 4 7 +3
@kbn/test 238 242 +4
total +8
Unknown metric groups

API count

id before after diff
@kbn/dev-utils 27 29 +2
@kbn/es 4 8 +4
@kbn/test 282 289 +7
total +13

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @Ikuni17

@Ikuni17 Ikuni17 merged commit 06ebc31 into elastic:main Aug 30, 2023
@Ikuni17 Ikuni17 deleted the test/162593/kbn-es-serverless-ftr branch August 30, 2023 20:28
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Aug 31, 2023
…X improvements. (elastic#162673)

Closes elastic#162593
Closes elastic#163939 
Closes elastic#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: elastic#165135
Observability: elastic#165138
Response Ops: elastic#165145

---------

Co-authored-by: Dzmitry Lemechko <[email protected]>
Co-authored-by: Tiago Costa <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Patryk Kopycinski <[email protected]>
banderror added a commit that referenced this pull request Sep 9, 2023
…rverless (#165966)

**Resolves: #164441

## Summary

Skips all Cypress tests owned by
@elastic/security-detection-rule-management and
@elastic/security-detection-engine teams in Serverless using the new
`@skipInServerless` tag.

- Adds a new `@skipInServerless` tag
- Updates `x-pack/test/security_solution_cypress/cypress/README.md` to
explain when to use what tags
- Explicitly adds missing tags to all D&R tests
- Adds `// TODO:` comments to tests with links to follow-up tickets
- Fixes the
`x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts`
script (see below)

Follow-up work:

- #161540
- #161539

## Context

> Serverless test failures will soon block PR merge

> During the development of the serverless test infrastructure, we
decided that serverless tests will only soft-fail. That means you see
the test failure in your PR but you're still able to merge. We did that
mainly in order to not block delivery of stateful features and bug fixes
while serverless tests and pipelines were implemented and stabilized.
We now have the major building blocks for the serverless test
infrastructure in place and will integrate serverless tests in our
regular pipelines. As part of this process, we're skipping failing and
flaky serverless tests that came in during the soft-fail phase. Once
this is done, a PR with serverless test failures can no longer be
merged, similar to how we have it for stateful test failures.

> We plan to merge this in the next few days and we'll send out another
notification when it's done.

## Fixing `parallel.ts`

There were two problems with the
`x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts`
script we use for running Cypress tests:

- The script was broken in #162673
(here on [this
line](https://github.com/elastic/kibana/pull/162673/files#diff-9f40ced6d29c4fc2709af881680400293d8ce1bc9ebb07b9138d6d99c83c09c9R67))
- I think it has never supported situations when all tests matching a
spec pattern (such as
`./cypress/e2e/!(investigations|explore)/**/*.cy.ts`) end up being
skipped via Cypress tags (such as `@skipInServerless`)

Both the issues are fixed in this PR.

Code owners are added for this script in the CODEOWNERS file to prevent
breaking this script in future PRs.
pgayvallet added a commit that referenced this pull request Sep 11, 2023
…#164959)

## Summary

~~Blocked by #162673

Add some initial integration test coverage for SO migrations when
running against serverless Elasticsearch:
- our migration actions test suite 
- some of the zdt algo migration suites 

The actions test suite was adapted to skip, when run against serverless,
the tests that are not supposed to be run (or passing) in that
environment
@Ikuni17 Ikuni17 changed the title ESS support for FTR serverless tests. SSL support in kbn/es. kbn/es DX improvements. ES Serverless support for FTR serverless tests. SSL support in kbn/es. kbn/es DX improvements. Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting chore ci:serverless-test-all release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v8.11.0
Projects
None yet