Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions src/dev/eslint/types.eslint.config.template.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,47 @@ module.exports = {
},
overrides: [
{
files: ['server/**/*', '*functional*/**/*', '*api_integration*/**/*'],
files: [
'server/**/*',
'accessibility/apps/**/*',
'analytics/tests/**/*',
'*functional*/**/*',
'*api_integration*/**/*',
'cloud_integration/tests/**/*',
'custom_branding/tests/**/*',
'disable_ems/tests/**/*',
'examples/**/*',
'fleet_multi_cluster/apps/**/*',
'ftr_apis/**/*',
'health_gateway/tests/**/*',
'localization/tests/**/*',
'plugin_api_perf/test_suites/**/*',
'rule_registry/**/*',
'search_sessions_integration/tests/**/*',
'screenshot_creation/apps/**/*',
'serverless/api_integration/**/*',
'serverless/functional/**/*',
'ui_capabilities/**/*',
'upgrade/apps/**/*',
'usage_collection/test_suites/**/*',
],
rules: {
// Let's focus on server-side errors first to avoid server crashes.
// We'll tackle /public eventually.
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-floating-promises': [
'error',
{
ignoreIIFE: false,
checkThenables: true, // check for thenable objects (not just native Promises)
},
],
},
},
{
files: [
'*spaces_api_integration/common/services/basic_auth_supertest.ts',
// TODO: high chances missing awaits cause test flakiness, 37 errors spotted
'x-pack/solutions/security/test/security_solution_api_integration/**/*'],
'*security_solution_api_integration/scripts/mki_api_ftr_execution.ts',
],
rules: {
'@typescript-eslint/no-floating-promises': 'off',
},
Expand Down
4 changes: 2 additions & 2 deletions src/platform/test/examples/state_sync/todo_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
expect(await browser.getCurrentUrl()).to.contain('completed:!f');

// check the checkbox by clicking the label (clicking checkbox directly fails as it is "no intractable")
(await find.byCssSelector('label[for="0"]')).click();
await find.clickByCssSelector('label[for="0"]');

// wait for react to update dom and checkbox in checked state
await retry.tryForTime(1000, async () => {
Expand Down Expand Up @@ -130,7 +130,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
expect(await testSubjects.isChecked('todoCheckbox-0')).to.be(false);
expect(await browser.getCurrentUrl()).to.contain('completed:!f');
// check the checkbox by clicking the label (clicking checkbox directly fails as it is "no intractable")
(await find.byCssSelector('label[for="0"]')).click();
await find.clickByCssSelector('label[for="0"]');

// wait for react to update dom and checkbox in checked state
await retry.tryForTime(1000, async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await searchSessions.deleteAllSearchSessions();
await PageObjects.common.navigateToApp('dashboard');
log.debug('wait for dashboard landing page');
await retry.tryForTime(10000, async () => {
testSubjects.existOrFail('dashboardLandingPage');
});
await testSubjects.existOrFail('dashboardLandingPage', { timeout: 10000 });
await searchSessions.markTourDone();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const cleanupDatastreams = async (es: Client) => {
};

export const cleanupIngestPipelines = async (es: Client) => {
es.ingest.deletePipeline({ id: `${INGEST_PIPELINE_PREFIX}*` });
await es.ingest.deletePipeline({ id: `${INGEST_PIPELINE_PREFIX}*` });
};

export const cleanupPolicies = async (es: Client) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ export function SecuritySolutionServerlessUtils({

// Invalidate API keys when all tests have finished.
lifecycle.cleanup.add(async () => {
rolesCredentials.forEach((credential, role) => {
log.debug(`Invalidating API key for role [${role}]`);
invalidateApiKey(credential);
});
const invalidationPromises = Array.from(rolesCredentials.entries()).map(
async ([role, credential]) => {
log.debug(`Invalidating API key for role [${role}]`);
await invalidateApiKey(credential);
}
);
await Promise.all(invalidationPromises);
});

const createSuperTest = async (role = 'admin') => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(alertsResponseFromFirstRuleExecution.hits.hits).toHaveLength(100);

// re-trigger rule execution
runSoonRule(supertest, createdRule.id);
await runSoonRule(supertest, createdRule.id);

const alertsResponse = await getOpenAlerts(
supertest,
Expand Down Expand Up @@ -935,7 +935,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(alertsResponseFromFirstRuleExecution.hits.hits).toHaveLength(100);

// re-trigger rule execution
runSoonRule(supertest, createdRule.id);
await runSoonRule(supertest, createdRule.id);

const alertsResponse = await getOpenAlerts(
supertest,
Expand Down Expand Up @@ -1014,7 +1014,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(alertsResponseFromFirstRuleExecution.hits.hits).toHaveLength(100);

// re-trigger rule execution
runSoonRule(supertest, createdRule.id);
await runSoonRule(supertest, createdRule.id);

const alertsResponse = await getOpenAlerts(
supertest,
Expand Down Expand Up @@ -1076,7 +1076,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(alertsResponseFromFirstRuleExecution.hits.hits).toHaveLength(100);

// re-trigger rule execution
runSoonRule(supertest, createdRule.id);
await runSoonRule(supertest, createdRule.id);

const alertsResponse = await getOpenAlerts(
supertest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleExists({ getService, id: schedule.id });
await checkIfScheduleExists({ getService, id: schedule.id });
});

it('should create a new schedule with `enabled` defaulted to `false`', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleExists({ getService, id: schedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleExists({ getService, id: schedule.id, kibanaSpace: kibanaSpace1 });
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default ({ getService }: FtrProviderContext) => {
expect.objectContaining({ ...getSimpleAttackDiscoverySchedule() })
);

checkIfScheduleExists({ getService, id: schedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleExists({ getService, id: schedule.id, kibanaSpace: kibanaSpace1 });
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default ({ getService }: FtrProviderContext) => {
const deleteResult = await apis.delete({ id: createdSchedule.id });
expect(deleteResult).toEqual({ id: createdSchedule.id });

checkIfScheduleDoesNotExist({ getService, id: createdSchedule.id });
await checkIfScheduleDoesNotExist({ getService, id: createdSchedule.id });
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(deleteResult).toEqual({ id: createdSchedule.id });

// Check that schedule has been deleted
checkIfScheduleDoesNotExist({
await checkIfScheduleDoesNotExist({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
Expand All @@ -85,7 +85,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleExists({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleExists({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});

it('should not be able to delete a schedule in a space without kibana privileges for that space', async () => {
Expand All @@ -106,7 +110,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleExists({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleExists({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleExists({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleExists({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});

it('should not be able to delete a schedule in a space without kibana privileges for that space', async () => {
Expand All @@ -117,7 +121,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleExists({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleExists({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default ({ getService }: FtrProviderContext) => {
await apis.disable({ id: createdSchedule.id });

// Check that schedule is disabled
checkIfScheduleDisabled({ getService, id: createdSchedule.id });
await checkIfScheduleDisabled({ getService, id: createdSchedule.id });
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export default ({ getService }: FtrProviderContext) => {
kibanaSpace: kibanaSpace1,
});

checkIfScheduleDisabled({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleDisabled({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default ({ getService }: FtrProviderContext) => {

await apis.disable({ id: createdSchedule.id, kibanaSpace: kibanaSpace1 });

checkIfScheduleDisabled({
await checkIfScheduleDisabled({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleDisabled({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleDisabled({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});

it('should not be able to enable a schedule in a space without kibana privileges for that space', async () => {
Expand All @@ -100,7 +104,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleDisabled({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleDisabled({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleDisabled({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleDisabled({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});

it('should not be able to enable a schedule in a space without kibana privileges for that space', async () => {
Expand All @@ -113,7 +117,11 @@ export default ({ getService }: FtrProviderContext) => {
})
);

checkIfScheduleDisabled({ getService, id: createdSchedule.id, kibanaSpace: kibanaSpace1 });
await checkIfScheduleDisabled({
getService,
id: createdSchedule.id,
kibanaSpace: kibanaSpace1,
});
});
});
});
Expand Down