Skip to content

Commit

Permalink
[APM] Fix apm e2e tests (#133941)
Browse files Browse the repository at this point in the history
* 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 a5992d5.

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>
  • Loading branch information
4 people authored Jun 9, 2022
1 parent b077e75 commit a3268de
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 52 deletions.
2 changes: 1 addition & 1 deletion packages/elastic-apm-synthtrace/bin/synthtrace
Original file line number Diff line number Diff line change
Expand Up @@ -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();
9 changes: 9 additions & 0 deletions packages/elastic-apm-synthtrace/src/cli.ts
Original file line number Diff line number Diff line change
@@ -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';
1 change: 0 additions & 1 deletion packages/elastic-apm-synthtrace/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion scripts/synthtrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/ftr_e2e/synthtrace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit a3268de

Please sign in to comment.