Cleaning up after DLS functional tests. (#122426) (#122629)

(cherry picked from commit 2ba281b8aa)

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
This commit is contained in:
Kibana Machine 2022-01-11 05:21:35 -05:00 committed by GitHub
parent af4610ab24
commit c91b1a5916
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -34,11 +34,9 @@ export class Role {
path: `/api/security/role/${name}`,
method: 'DELETE',
});
if (status !== 204 && status !== 404) {
if (status !== 204) {
throw new Error(
`Expected status code of 204 or 404, received ${status} ${statusText}: ${util.inspect(
data
)}`
`Expected status code of 204, received ${status} ${statusText}: ${util.inspect(data)}`
);
}
}

View file

@ -15,6 +15,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const log = getService('log');
const screenshot = getService('screenshots');
const security = getService('security');
const PageObjects = getPageObjects(['security', 'common', 'header', 'discover', 'settings']);
const kibanaServer = getService('kibanaServer');
@ -80,9 +81,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const rowData = await PageObjects.discover.getDocTableIndex(1);
expect(rowData).to.contain('EAST');
});
after('logout', async () => {
// NOTE: Logout needs to happen before anything else to avoid flaky behavior
await PageObjects.security.forceLogout();
await security.user.delete('userEast');
await security.role.delete('myroleEast');
});
});
}