Skip to content

Commit

Permalink
Migrated Snapshot and Restore tests to use test user.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuff-links committed Feb 18, 2022
1 parent 8e88efa commit da8f83b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
5 changes: 3 additions & 2 deletions x-pack/test/functional/apps/snapshot_restore/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const pageObjects = getPageObjects(['common', 'snapshotRestore']);
const log = getService('log');
const es = getService('es');
const security = getService('security');

describe('Home page', function () {
before(async () => {
await security.testUser.setRoles(['snapshot_restore_user'], true);
await pageObjects.common.navigateToApp('snapshotRestore');
});

Expand Down Expand Up @@ -46,9 +48,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

it('cleanup repository', async () => {
await pageObjects.snapshotRestore.viewRepositoryDetails('my-repository');
await pageObjects.common.sleep(25000);
const cleanupResponse = await pageObjects.snapshotRestore.performRepositoryCleanup();
await pageObjects.common.sleep(25000);
expect(cleanupResponse).to.contain('results');
expect(cleanupResponse).to.contain('deleted_bytes');
expect(cleanupResponse).to.contain('deleted_blobs');
Expand All @@ -57,6 +57,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await es.snapshot.deleteRepository({
name: 'my-repository',
});
await security.testUser.restoreDefaults();
});
});
});
Expand Down
20 changes: 20 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,26 @@ export default async function ({ readConfigFile }) {
],
},

snapshot_restore_user: {
elasticsearch: {
cluster: ['monitor', 'create_snapshot', 'manage'],
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
advancedSettings: ['read'],
},
spaces: ['*'],
},
],
},

ingest_pipelines_user: {
elasticsearch: {
cluster: ['manage_pipeline', 'cluster:monitor/nodes/info'],
Expand Down
5 changes: 4 additions & 1 deletion x-pack/test/functional/page_objects/snapshot_restore_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
const repoToView = repos.filter((r) => (r.repoName = name))[0];
await repoToView.repoLink.click();
}
await retry.waitForWithTimeout(`Repo title should be ${name}`, 10000, async () => {
await retry.waitForWithTimeout(`Repo title should be ${name}`, 25000, async () => {
return (await testSubjects.getVisibleText('title')) === name;
});
},
async performRepositoryCleanup() {
await testSubjects.click('cleanupRepositoryButton');
await retry.waitForWithTimeout(`wait for code block to be visible`, 25000, async () => {
return await testSubjects.isDisplayed('cleanupCodeBlock');
});
return await testSubjects.getVisibleText('cleanupCodeBlock');
},
};
Expand Down

0 comments on commit da8f83b

Please sign in to comment.