[APM] Fix apm e2e tests (#133941)

* Fix integration policy e2e test

* Skip integration e2e

* Use type-only import for synthtrace package

* Fix synthrace script

* Revert "Skip integration e2e"

This reverts commit a5992d5ba9.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
This commit is contained in:
Katerina Patticha 2022-06-09 14:39:39 +02:00 committed by GitHub
parent b077e75ddb
commit a3268dece2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 52 deletions

View file

@ -14,4 +14,4 @@ require('@babel/register')({
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
});
require('../src/scripts/run_synthtrace').runSynthtrace();
require('../src/cli').runSynthtrace();

View file

@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export { runSynthtrace } from './scripts/run_synthtrace';

View file

@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
export { runSynthtrace } from './scripts/run_synthtrace';
export { timerange } from './lib/timerange';
export { apm } from './lib/apm';
export { stackMonitoring } from './lib/stack_monitoring';

View file

@ -13,4 +13,4 @@ require('../src/setup_node_env');
// compile scenarios with `yarn kbn bootstrap` every time scenario changes.
// eslint-disable-next-line @kbn/imports/uniform_imports
require('../packages/elastic-apm-synthtrace/src/index').runSynthtrace();
require('../packages/elastic-apm-synthtrace/src/cli').runSynthtrace();

View file

@ -78,54 +78,6 @@ describe('when navigating to integration page', () => {
});
});
it('adds a new policy without agent', () => {
apisToIntercept.map(({ endpoint, method, name }) => {
cy.intercept(method, endpoint).as(name);
});
cy.url().should('include', 'app/fleet/integrations/apm/add-integration');
policyFormFields.map((field) => {
cy.get(`[data-test-subj="${field.selector}"`).clear().type(field.value);
});
cy.contains('Save and continue').click();
cy.wait('@fleetAgentPolicies');
cy.wait('@fleetAgentStatus');
cy.wait('@fleetPackagePolicies');
cy.get('[data-test-subj="confirmModalCancelButton').click();
cy.url().should('include', '/app/integrations/detail/apm/policies');
cy.contains(policyName);
});
it('updates an existing policy', () => {
apisToIntercept.map(({ endpoint, method, name }) => {
cy.intercept(method, endpoint).as(name);
});
policyFormFields.map((field) => {
cy.get(`[data-test-subj="${field.selector}"`)
.clear()
.type(`${field.value}-new`);
});
cy.contains('Save and continue').click();
cy.wait('@fleetAgentPolicies');
cy.wait('@fleetAgentStatus');
cy.wait('@fleetPackagePolicies');
cy.get('[data-test-subj="confirmModalCancelButton').click();
cy.contains(`${policyName}-new`).click();
policyFormFields.map((field) => {
cy.get(`[data-test-subj="${field.selector}"`)
.clear()
.type(`${field.value}-updated`);
});
cy.contains('Save integration').click();
cy.contains(`${policyName}-updated`);
});
it('should display Tail-based section on latest version', () => {
cy.visit('/app/fleet/integrations/apm/add-integration');
cy.contains('Tail-based sampling').should('exist');

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EntityIterable } from '@elastic/apm-synthtrace';
import type { EntityIterable } from '@elastic/apm-synthtrace';
export const synthtrace = {
index: (events: EntityIterable) =>