5c2a08de6d
* Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
114 lines
4 KiB
JavaScript
114 lines
4 KiB
JavaScript
import { click, currentRouteName, visit } from '@ember/test-helpers';
|
|
// TESTS HERE ARE SKPPED
|
|
// running vault with -dev-leased-kv flag lets you run some of these tests
|
|
// but generating leases programmatically is currently difficult
|
|
//
|
|
// TODO revisit this when it's easier to create leases
|
|
|
|
import { module, skip } from 'qunit';
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
import secretList from 'vault/tests/pages/secrets/backend/list';
|
|
import secretEdit from 'vault/tests/pages/secrets/backend/kv/edit-secret';
|
|
import mountSecrets from 'vault/tests/pages/settings/mount-secret-backend';
|
|
import authPage from 'vault/tests/pages/auth';
|
|
import logout from 'vault/tests/pages/logout';
|
|
|
|
module('Acceptance | leases', function (hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(async function () {
|
|
await authPage.login();
|
|
this.enginePath = `kv-for-lease-${new Date().getTime()}`;
|
|
// need a version 1 mount for leased secrets here
|
|
return mountSecrets.visit().path(this.enginePath).type('kv').version(1).submit();
|
|
});
|
|
|
|
hooks.afterEach(function () {
|
|
return logout.visit();
|
|
});
|
|
|
|
const createSecret = async (context, isRenewable) => {
|
|
context.name = `secret-${new Date().getTime()}`;
|
|
await secretList.visitRoot({ backend: context.enginePath });
|
|
await secretList.create();
|
|
if (isRenewable) {
|
|
await secretEdit.createSecret(context.name, 'ttl', '30h');
|
|
} else {
|
|
await secretEdit.createSecret(context.name, 'foo', 'bar');
|
|
}
|
|
};
|
|
|
|
const navToDetail = async (context) => {
|
|
await visit('/vault/access/leases/');
|
|
await click(`[data-test-lease-link="${context.enginePath}/"]`);
|
|
await click(`[data-test-lease-link="${context.enginePath}/${context.name}/"]`);
|
|
await click(`[data-test-lease-link]:eq(0)`);
|
|
};
|
|
|
|
skip('it renders the show page', function (assert) {
|
|
createSecret(this);
|
|
navToDetail(this);
|
|
assert.equal(
|
|
currentRouteName(),
|
|
'vault.cluster.access.leases.show',
|
|
'a lease for the secret is in the list'
|
|
);
|
|
assert
|
|
.dom('[data-test-lease-renew-picker]')
|
|
.doesNotExist('non-renewable lease does not render a renew picker');
|
|
});
|
|
|
|
// skip for now until we find an easy way to generate a renewable lease
|
|
skip('it renders the show page with a picker', function (assert) {
|
|
createSecret(this, true);
|
|
navToDetail(this);
|
|
assert.equal(
|
|
currentRouteName(),
|
|
'vault.cluster.access.leases.show',
|
|
'a lease for the secret is in the list'
|
|
);
|
|
assert
|
|
.dom('[data-test-lease-renew-picker]')
|
|
.exists({ count: 1 }, 'renewable lease renders a renew picker');
|
|
});
|
|
|
|
skip('it removes leases upon revocation', async function (assert) {
|
|
createSecret(this);
|
|
navToDetail(this);
|
|
await click('[data-test-lease-revoke] button');
|
|
await click('[data-test-confirm-button]');
|
|
assert.equal(
|
|
currentRouteName(),
|
|
'vault.cluster.access.leases.list-root',
|
|
'it navigates back to the leases root on revocation'
|
|
);
|
|
await click(`[data-test-lease-link="${this.enginePath}/"]`);
|
|
await click('[data-test-lease-link="data/"]');
|
|
assert
|
|
.dom(`[data-test-lease-link="${this.enginePath}/data/${this.name}/"]`)
|
|
.doesNotExist('link to the lease was removed with revocation');
|
|
});
|
|
|
|
skip('it removes branches when a prefix is revoked', async function (assert) {
|
|
createSecret(this);
|
|
await visit(`/vault/access/leases/list/${this.enginePath}`);
|
|
await click('[data-test-lease-revoke-prefix] button');
|
|
await click('[data-test-confirm-button]');
|
|
assert.equal(
|
|
currentRouteName(),
|
|
'vault.cluster.access.leases.list-root',
|
|
'it navigates back to the leases root on revocation'
|
|
);
|
|
assert
|
|
.dom(`[data-test-lease-link="${this.enginePath}/"]`)
|
|
.doesNotExist('link to the prefix was removed with revocation');
|
|
});
|
|
|
|
skip('lease not found', async function (assert) {
|
|
await visit('/vault/access/leases/show/not-found');
|
|
assert
|
|
.dom('[data-test-lease-error]')
|
|
.hasText('not-found is not a valid lease ID', 'it shows an error when the lease is not found');
|
|
});
|
|
});
|