Skip to content

Commit

Permalink
Fix serverless tests for ingest pipelines and dataset quality (elasti…
Browse files Browse the repository at this point in the history
…c#178825)

## Summary

This PR fixes test failures that came up when the serverless
observability functional tests for dataset quality and ingest pipelines
were run against the same project.

### Details

The problem that we saw:
* The dataset quality tests are calling
`PageObjects.observabilityLogsExplorer.setupInitialIntegrations()`,
which sets up a list of integrations, including many ingest pipelines.
However, there was no cleanup of these installed integrations so the
test suite left all the integrations and ingest pipelines behind.
* The ingest pipelines tests were looking for a newly created pipeline
in the list, but only checking the first page of 50 items in the UI,
assuming that there are less than 50 pipelines existing. With the many
pipelines left behind by the dataset quality tests, this suite failed as
it couldn't find the created pipeline.

How this PR fixes it:
* The ingest pipeline tests have been stabilized so they can deal with
more existing pipelines by adding an optional `searchFor` parameter to
`getPipelinesList`. If this parameter is provided, the pipeline list
will be searched for the provided search term before returning the list
items. That way long lists can be filtered down to the items relevant to
the test.
* The dataset quality tests (stateful and serverless version) have been
updated to include
`PageObjects.observabilityLogsExplorer.removeInstalledPackages()` in the
`after` method of the suite so they don't leave integrations behind.

Flaky test runner for the three impacted configurations:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5492
- passed ✔️
  • Loading branch information
pheyos authored Mar 16, 2024
1 parent acc5beb commit 4383ab1
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export const PipelineTable: FunctionComponent<Props> = ({
],
box: {
incremental: true,
'data-test-subj': 'pipelineTableSearch',
},
filters: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid

after(async () => {
await synthtrace.clean();
await PageObjects.observabilityLogsExplorer.removeInstalledPackages();
});

it('opens the flyout for the right dataset', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid

after(async () => {
await synthtrace.clean();
await PageObjects.observabilityLogsExplorer.removeInstalledPackages();
});

it('shows the right number of rows in correct order', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid

after(async () => {
await synthtrace.clean();
await PageObjects.observabilityLogsExplorer.removeInstalledPackages();
});

it('hides inactive datasets when toggled', async () => {
Expand Down
11 changes: 10 additions & 1 deletion x-pack/test/functional/page_objects/ingest_pipelines_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP
await pageObjects.header.waitUntilLoadingHasFinished();
},

async getPipelinesList() {
async getPipelinesList(options?: { searchFor?: string }) {
if (options?.searchFor) {
await this.searchPipelineList(options.searchFor);
}

const pipelines = await testSubjects.findAll('pipelineTableRow');

const getPipelineName = async (pipeline: WebElementWrapper) => {
Expand All @@ -67,6 +71,11 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP
return await Promise.all(pipelines.map((pipeline) => getPipelineName(pipeline)));
},

async searchPipelineList(searchTerm: string) {
await pageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.setValue('pipelineTableSearch', searchTerm);
},

async clickPipelineLink(index: number) {
const links = await testSubjects.findAll('pipelineDetailsLink');
await links.at(index)?.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
it('Displays the test pipeline in the list of pipelines', async () => {
log.debug('Checking that the test pipeline is in the pipelines list.');
await pageObjects.ingestPipelines.increasePipelineListPageSize();
const pipelines = await pageObjects.ingestPipelines.getPipelinesList();
const pipelines = await pageObjects.ingestPipelines.getPipelinesList({
searchFor: TEST_PIPELINE_NAME,
});
expect(pipelines).to.contain(TEST_PIPELINE_NAME);
});

Expand All @@ -83,7 +85,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await pageObjects.ingestPipelines.closePipelineDetailsFlyout();
await pageObjects.ingestPipelines.increasePipelineListPageSize();
const pipelinesList = await pageObjects.ingestPipelines.getPipelinesList();
const pipelinesList = await pageObjects.ingestPipelines.getPipelinesList({
searchFor: TEST_PIPELINE_NAME,
});
const newPipelineExists = Boolean(
pipelinesList.find((pipelineName) => pipelineName === PIPELINE.name)
);
Expand All @@ -96,7 +100,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await pageObjects.ingestPipelines.closePipelineDetailsFlyout();
await pageObjects.ingestPipelines.increasePipelineListPageSize();
const pipelinesList = await pageObjects.ingestPipelines.getPipelinesList();
const pipelinesList = await pageObjects.ingestPipelines.getPipelinesList({
searchFor: TEST_PIPELINE_NAME,
});
const newPipelineExists = Boolean(
pipelinesList.find((pipelineName) => pipelineName === PIPELINE.name)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

after(async () => {
await synthtrace.clean();
await PageObjects.observabilityLogsExplorer.removeInstalledPackages();
});

it('opens the flyout for the right dataset', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

after(async () => {
await synthtrace.clean();
await PageObjects.observabilityLogsExplorer.removeInstalledPackages();
});

it('shows the right number of rows in correct order', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

after(async () => {
await synthtrace.clean();
await PageObjects.observabilityLogsExplorer.removeInstalledPackages();
});

it('hides inactive datasets when toggled', async () => {
Expand Down

0 comments on commit 4383ab1

Please sign in to comment.