Skip to content

Commit

Permalink
[Security Solution] fix flaky endpoint cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joeypoon committed Dec 12, 2023
1 parent 1b0b024 commit 4694c51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ import { createEndpointHost } from '../../tasks/create_endpoint_host';
import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data';
import { enableAllPolicyProtections } from '../../tasks/endpoint_policy';

// Failing: See https://github.com/elastic/kibana/issues/169903
describe.skip('Endpoints page', { tags: ['@ess', '@serverless'] }, () => {
describe('Endpoints page', { tags: ['@ess', '@serverless'] }, () => {
let indexedPolicy: IndexedFleetEndpointPolicyResponse;
let policy: PolicyData;
let createdHost: CreateAndEnrollEndpointHostResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ describe('When accessing Endpoint Response Console', { tags: ['@ess', '@serverle
login();
});

// FLAKY: https://github.com/elastic/kibana/issues/169894
describe.skip('from Cases', () => {
describe('from Cases', () => {
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts>;
let caseData: ReturnTypeFromChainable<typeof indexNewCase>;
let alertData: ReturnTypeFromChainable<typeof indexEndpointRuleAlerts>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { KbnClient } from '@kbn/test';
import pRetry from 'p-retry';
import { kibanaPackageJson } from '@kbn/repo-info';
import type { ToolingLog } from '@kbn/tooling-log';
import { AGENTS_INDEX } from '@kbn/fleet-plugin/common';
import { STARTED_TRANSFORM_STATES } from '../../../../../common/constants';
import {
ENDPOINT_ALERTS_INDEX,
Expand Down Expand Up @@ -202,6 +203,13 @@ const waitForEndpoints = async (

await pRetry(
async () => {
if (index === METADATA_UNITED_INDEX) {
// United metadata transform occasionally can't find docs in .fleet-agents.
// Running a search on the index first eliminates this issue.
// Replacing the search with a refresh does not resolve flakiness.
await esClient.search({ index: AGENTS_INDEX });
}

const response = await esClient.search({
index,
size: expectedSize,
Expand Down

0 comments on commit 4694c51

Please sign in to comment.