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

[Fleet] Run locally the package registry during api integration tests #61699

Closed
nchaulet opened this issue Mar 27, 2020 · 7 comments · Fixed by #66736
Closed

[Fleet] Run locally the package registry during api integration tests #61699

nchaulet opened this issue Mar 27, 2020 · 7 comments · Fixed by #66736
Assignees
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Feature:Fleet Fleet team's agent central management project Ingest Management:alpha1 Group issues for ingest management alpha1 Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@nchaulet
Copy link
Member

We have some api integration tests that depends on reaching package registry (https://github.com/elastic/package-registry)

So some tests could fail because we are not able to reach the package manager, and we should not rely on external services during API integration tests.

As discussed offline it's possible to run the package manager during tests. The package manager is a go application stateless, no database are required, and a docker container is already available to run it.

cc @spalger @jonathan-buttner

@nchaulet nchaulet added Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team labels Mar 27, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Feature:EPM)

@nchaulet nchaulet changed the title [Fleet][EPM] Run locally the package registry [Fleet][EPM] Run locally the package registry during api integration tests Mar 30, 2020
@nchaulet nchaulet changed the title [Fleet][EPM] Run locally the package registry during api integration tests [Fleet] Run locally the package registry during api integration tests Mar 30, 2020
@ruflin ruflin added the Ingest Management:alpha1 Group issues for ingest management alpha1 label Apr 2, 2020
@skh skh assigned skh and unassigned nchaulet May 15, 2020
@jonathan-buttner
Copy link
Contributor

So some tests could fail because we are not able to reach the package manager, and we should not rely on external services during API integration tests.

Just a note, we'll want to use a local registry for endpoint's functional tests too, not just API integration tests.

@skh
Copy link
Contributor

skh commented May 15, 2020

@jonathan-buttner Could you point me at an example of such a functional test in/for the endpoint plugin?

@jonathan-buttner
Copy link
Contributor

@jonathan-buttner Could you point me at an example of such a functional test in/for the endpoint plugin?

@skh
The endpoint functional tests are here:
https://github.com/elastic/kibana/blob/master/x-pack/test/functional_endpoint
https://github.com/elastic/kibana/tree/master/x-pack/test/functional_endpoint_ingest_failure

I'm not sure exactly how many of the functional_endpoint actually interact with the ingest manager directly but since endpoint relies on the ingest manager to get the ES index pattern for it's queries it's likely most of the tests.

This was the test suite that failed recently because of the package registry change: https://github.com/elastic/kibana/blob/master/x-pack/test/functional_endpoint/apps/endpoint/policy_list.ts#L16

This test checks to make sure the ingest manager initialized correctly (absence of a toast being displayed in the endpoint app): https://github.com/elastic/kibana/blob/master/x-pack/test/functional_endpoint/apps/endpoint/landing_page.ts#L26

It leverages this code: https://github.com/elastic/kibana/blob/master/x-pack/plugins/endpoint/public/applications/endpoint/view/setup.tsx#L42
Which uses ingest's contract here: https://github.com/elastic/kibana/blob/master/x-pack/plugins/ingest_manager/public/plugin.ts#L28

The endpoint enables ingest manager here: https://github.com/elastic/kibana/blob/master/x-pack/test/functional_endpoint/config.ts#L34

For references the endpoint API tests are here:
https://github.com/elastic/kibana/blob/master/x-pack/test/api_integration/apis/endpoint/index.ts#L17

And leverage a service to call the setup API in ingest: https://github.com/elastic/kibana/blob/master/x-pack/test/api_integration/services/ingest_manager.ts#L12

@jen-huang
Copy link
Contributor

@nchaulet Could you double check the issues linked the PR (#66736) that closed this issue? I think it's unrelated so reopening this one.

@jen-huang jen-huang reopened this Jun 10, 2020
@nchaulet
Copy link
Member Author

@jen-huang You are right this is not fixed

@skh
Copy link
Contributor

skh commented Jun 29, 2020

Implemented in #69822

@skh skh closed this as completed Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Feature:Fleet Fleet team's agent central management project Ingest Management:alpha1 Group issues for ingest management alpha1 Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants