Skip to content

[APM] E2E: Zero config for running e2e locally#59152

Merged
sorenlouv merged 9 commits intoelastic:masterfrom
sorenlouv:use-env-variables-e2e
Mar 24, 2020
Merged

[APM] E2E: Zero config for running e2e locally#59152
sorenlouv merged 9 commits intoelastic:masterfrom
sorenlouv:use-env-variables-e2e

Conversation

@sorenlouv
Copy link
Copy Markdown
Contributor

@sorenlouv sorenlouv commented Mar 3, 2020

Changes

  • Use env vars for cypress (instead of importing kibana.dev.yml)
  • Use --config to load kibana.e2e.yml instead of the user's kibana.dev.yml.
  • Added run-e2e.sh script to automatically setup environment and run tests

TODO:

apm 2e2

Helpful error messages
image

image

@sorenlouv sorenlouv requested review from a team and v1v March 3, 2020 15:01
@sorenlouv sorenlouv added release_note:skip Skip the PR/issue when compiling release notes v7.7.0 labels Mar 3, 2020
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Enabling Security and ES and APM Server on non-default ports to avoid clashing with local development

@sorenlouv sorenlouv force-pushed the use-env-variables-e2e branch from 3ca9e26 to 1dfe5a3 Compare March 3, 2020 15:03
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refer to e2e specific config file (instead of moving it around)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is now specified in kibana.e2e.yml. Not something the user has to worry about.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Running kibana on a non-default port to avoid clashing with local development

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added all apm configurations to ensure they don't break without us noticing

Copy link
Copy Markdown
Contributor Author

@sorenlouv sorenlouv Mar 3, 2020

Choose a reason for hiding this comment

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

Provide credentials to Cypress via environment vars

@sorenlouv
Copy link
Copy Markdown
Contributor Author

retest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

kibana_system_user didn't work when I tried, so maybe admin could be a good one, what do you think?

Suggested change
elasticsearch.username: 'kibana_system_user'
elasticsearch.username: 'admin'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kibana shouldn't connect to ES with superuser privileges. According to the docs kibana_system_user should exist.

I can confirm that kibana_system_user can access ES like:

curl --user kibana_system_user:changeme -X GET "localhost:9201/_security/user/_has_privileges?pretty" -H 'Content-Type: application/json' -d'{ "cluster": [ "monitor", "manage" ] }'

which returns:

{
  "username" : "kibana_system_user",
  "has_all_requested" : false,
  "cluster" : {
    "monitor" : true,
    "manage" : false
  },
  "index" : { },
  "application" : { }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you try running that and LMK if it works?

Copy link
Copy Markdown
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

👍 once conflicts resolved and up to date and tests pass.

@sorenlouv sorenlouv changed the title [APM] E2E: Use env vars over kibana.yml [APM] E2E: Improve local DX by running all with single command Mar 20, 2020
@sorenlouv sorenlouv changed the title [APM] E2E: Improve local DX by running all with single command [APM] E2E: Zero config for running e2e locally Mar 20, 2020
v1v added a commit to v1v/kibana that referenced this pull request Mar 21, 2020
v1v added a commit to v1v/kibana that referenced this pull request Mar 22, 2020
@cachedout
Copy link
Copy Markdown
Contributor

Hi @sqren

I'm helping to triage high-priority issues for @elastic/observablt-robots . Just so I understand, are the TODO items listed above part of this PR or is the intention to address them in follow-up PRs?

@sorenlouv sorenlouv force-pushed the use-env-variables-e2e branch from e2dbda9 to 4e8d51a Compare March 24, 2020 11:12
@sorenlouv
Copy link
Copy Markdown
Contributor Author

Hey @cachedout,

I've just pushed a commit that fixes most of the issues. Only remaining issue is that apm-integration-testing does not return a non-zero exit code upon error. This should be fixed in https://github.com/elastic/apm-integration-testing but not something that should block this PR.

I'll merge this as soon as CI is green

@kuisathaverat
Copy link
Copy Markdown
Contributor

@sqren Do exist an issue for that on the https://github.com/elastic/apm-integration-testing? I do not see any. Would you mind fill one with the details of what happens?

@sorenlouv
Copy link
Copy Markdown
Contributor Author

@kuisathaverat elastic/apm-integration-testing#800

@sorenlouv
Copy link
Copy Markdown
Contributor Author

retest

## Might help to avoid FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
export NODE_OPTIONS="--max-old-space-size=4096"
nohup node scripts/kibana --no-base-path --csp.strict=false --optimize.watch=false> kibana.log 2>&1 &
nohup node scripts/kibana --config "${E2E_DIR}/ci/kibana.e2e.yml" --no-base-path --optimize.watch=false> kibana.log 2>&1 &
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the difference with https://github.com/elastic/kibana/pull/59152/files#diff-ccfe59ee0ec66fe86f6596aaf1fce60cR24? Are those flags also required in the CI?

Copy link
Copy Markdown
Contributor Author

@sorenlouv sorenlouv Mar 24, 2020

Choose a reason for hiding this comment

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

This starts in dev mode

node ./scripts/kibana --no-base-path --dev --no-dev-config --config x-pack/legacy/plugins/apm/e2e/ci/kibana.e2e.yml

This starts in prod mode

node scripts/kibana --no-base-path --optimize.watch=false --config "${E2E_DIR}/ci/kibana.e2e.yml" 

I think we should choose whatever is faster on CI. I guess we can test by running it 100 times or so on the CI in each mode.
I imagine dev compiles faster (because it doesn't need to compress resources) but prod has faster browser load times because assets are smaller. So could go both ways.

The reason I opted for using dev mode locally is because this is what developers is normally running, and I saw some issues when running prod mode without cleaning up after having run dev mode.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the clarification, I'd say to use the same as the local one to avoid any misleading, then it will be easy to reproduce it anyway. Thanks again

v1v added a commit to v1v/kibana that referenced this pull request Mar 24, 2020
@sorenlouv
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

v1v added a commit to v1v/kibana that referenced this pull request Mar 24, 2020
then we don't need to trap the errorlevel
@sorenlouv sorenlouv merged commit 0fc0440 into elastic:master Mar 24, 2020
@sorenlouv sorenlouv deleted the use-env-variables-e2e branch March 24, 2020 19:28
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

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

@v1v v1v mentioned this pull request Mar 30, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes v7.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants