Flaky test (#12832)

* mess with return

* removing filter for testing on circle ci

* no only enterprise

* testing

* revert

* add settled

* sprinkled those settleds

* stuff
This commit is contained in:
Angel Garbarino 2021-10-15 10:44:22 -06:00 committed by GitHub
parent 58ec5e41c3
commit a69f9b6429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 6 deletions

View File

@ -91,18 +91,22 @@ module('Acceptance | auth', function(hooks) {
test('it shows the token warning beacon on the menu', async function(assert) {
let authService = this.owner.lookup('service:auth');
await authPage.login();
await settled();
await consoleComponent.runCommands([
'write -field=client_token auth/token/create policies=default ttl=1h',
]);
let token = consoleComponent.lastTextOutput;
await logout.visit();
await settled();
await authPage.login(token);
await settled();
this.clock.tick(authService.IDLE_TIMEOUT);
authService.shouldRenew();
await settled();
assert.dom('[data-test-allow-expiration="true"]').exists('shows expiration beacon');
await visit('/vault/access');
await settled();
assert.dom('[data-test-allow-expiration="true"]').doesNotExist('hides beacon when the api is used again');
});

View File

@ -71,7 +71,9 @@ module('Acceptance | Enterprise | control groups', function(hooks) {
const setupControlGroup = async context => {
let userpassAccessor;
await visit('/vault/secrets');
await settled();
await consoleComponent.toggle();
await settled();
await consoleComponent.runCommands([
//enable kv-v1 mount and write a secret
'write sys/mounts/kv type=kv',

View File

@ -22,6 +22,7 @@ const mount = async (shouldConfig = true) => {
const now = Date.now();
let path = `kmip-${now}`;
let addr = `127.0.0.1:${getRandomPort()}`; // use random port
await settled();
let commands = shouldConfig
? [`write sys/mounts/${path} type=kmip`, `write ${path}/config listen_addrs=${addr}`]
: [`write sys/mounts/${path} type=kmip`];
@ -36,8 +37,11 @@ const mount = async (shouldConfig = true) => {
const createScope = async () => {
let path = await mount();
await settled();
let scope = `scope-${Date.now()}`;
await settled();
await uiConsole.runCommands([`write ${path}/scope/${scope} -force`]);
await settled();
let res = uiConsole.lastLogOutput;
if (res.includes('Error')) {
throw new Error(`Error creating scope: ${res}`);
@ -47,8 +51,10 @@ const createScope = async () => {
const createRole = async () => {
let { path, scope } = await createScope();
await settled();
let role = `role-${Date.now()}`;
await uiConsole.runCommands([`write ${path}/scope/${scope}/role/${role} operation_all=true`]);
await settled();
let res = uiConsole.lastLogOutput;
if (res.includes('Error')) {
throw new Error(`Error creating role: ${res}`);
@ -58,6 +64,7 @@ const createRole = async () => {
const generateCreds = async () => {
let { path, scope, role } = await createRole();
await settled();
await uiConsole.runCommands([
`write ${path}/scope/${scope}/role/${role}/credential/generate format=pem -field=serial_number`,
]);
@ -70,8 +77,9 @@ const generateCreds = async () => {
module('Acceptance | Enterprise | KMIP secrets', function(hooks) {
setupApplicationTest(hooks);
hooks.beforeEach(function() {
return authPage.login();
hooks.beforeEach(async function() {
await authPage.login();
return;
});
test('it enables KMIP secrets engine', async function(assert) {
@ -177,8 +185,18 @@ module('Acceptance | Enterprise | KMIP secrets', function(hooks) {
});
test('it can create a role', async function(assert) {
let { path, scope } = await createScope();
let role = `role-${Date.now()}`;
// moving create scope here to help with flaky test
let path = await mount();
await settled();
let scope = `scope-for-can-create-role`;
await settled();
await uiConsole.runCommands([`write ${path}/scope/${scope} -force`]);
await settled();
let res = uiConsole.lastLogOutput;
if (res.includes('Error')) {
throw new Error(`Error creating scope: ${res}`);
}
let role = `role-new-role`;
await rolesPage.visit({ backend: path, scope });
await settled();
assert.ok(rolesPage.isEmpty, 'renders the empty role page');

View File

@ -13,9 +13,11 @@ export default create({
await this.visit({ with: 'token' });
await settled();
if (token) {
return await this.tokenInput(token).submit();
await this.tokenInput(token).submit();
return;
}
return await this.tokenInput('root').submit();
await this.tokenInput('root').submit();
return;
},
});