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

[PoC] feat: implement Contract tests for Fleet with Pact.io #80384

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mdelapenya
Copy link
Contributor

@mdelapenya mdelapenya commented Oct 13, 2020

Summary

It basically adds Pact as a dependency and creates a Pact verifier for Fleet. It will fetch contracts from a Github URL (pushed here: elastic/e2e-testing#339).

How to test this locally

Firstly, we have to initialise Fleet using the UI, and for that we need to have ES and Kibana up and running.

$ yarn es snapshot --license trial -E xpack.security.authc.api_key.enabled=true

In another terminal:

yarn start --no-base-path

To run the contract tests:

$ cd x-pack
$ npm install
$ npm run test:pact --prefix plugins/ingest_manager

fleet-contracts

Other concerns

I was not able to bypass the pre-commit error about Pact needing to be added as a dependency to package.json, which I think it is already done.

@mdelapenya mdelapenya self-assigned this Oct 13, 2020
@mdelapenya mdelapenya changed the title feat: implement Contract tests for Fleet with Pact.io [PoC] feat: implement Contract tests for Fleet with Pact.io Oct 13, 2020
@kibanamachine
Copy link
Contributor

kibanamachine commented Oct 13, 2020

💔 Build Failed

Failed CI Steps

Metrics [docs]

✅ unchanged

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

@mdelapenya
Copy link
Contributor Author

mdelapenya commented Oct 14, 2020

Things to do:

  1. solve lint error for PactJS dependency:

error '@pact-foundation/pact' should be listed in the project's dependencies. Run 'npm i -S @pact-foundation/pact' to add it import/no-extraneous-dependencies

  1. fix licenses for a third-party dependency:

ERROR Non-conforming licenses:
19:34:26 buffers
19:34:26 version: 0.1.1
19:34:26 all licenses: Custom: http://github.com/substack/node-bufferlist
19:34:26 invalid licenses: Custom: http://github.com/substack/node-bufferlist
19:34:26 path: ../../../kibana/node_modules/buffers

  1. exclude Pact tests from Jest tests:

19:43:49 FAIL plugins/ingest_manager/fleet.pact.test.js
19:43:49 ● Test suite failed to run
19:43:49
19:43:49 TypeError: Request.defaults is not a function
19:43:49
19:43:49 5 | */
19:43:49 6 |
19:43:49 > 7 | const { Verifier } = require('@pact-foundation/pact');
19:43:49 | ^
19:43:49 8 |
19:43:49 9 | describe('Pact Verification', () => {
19:43:49 10 | it('validates the expectations of E2E Tests', () => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants