081db3a240
* Update ember-cli to ~3.20 * Remove bad optional-feature * Remove ember-fetch dep * re-install ember-fetch * update model fragments pr * update ember model fragments correct package name * update ember composable helpers to solve array helper error * update ember-concurrency * add back engine dependencies, automatically removed during ember-cli-upgrade * make author-form-options component js file otherwise error * for now comment out withTestWaiter * add eslint-node and fix if not with unless in templates * fix linting for tab index of false is now -1 and add type button to all buttons without types * fix href errors for linting, likely have to come back and fix * using eslint fix flag to fix all this.gets * ember modules codemode removed files that had module twice, will fix in next commit * finish codemode ember-data-codemod needed to rename const model * more this.get removal codemode did not work * cont. removal of this.get * stop mixin rules until figure out how to reconfig them all * smaller eslint ignores * get codemode * testing app small fixes to bring it back after all the changes * small changes to eslint * test removal of getProperties * fix issue with baseKey because value could be unknown needed to add a question mark in nested get * smaller linting fixes * get nested fixes * small linting error fixes * small linting changes * working through more small linting changes * another round of linting modifications * liniting fixes * ember module codemod * quinit dom codemod * angle bracket codemod * discovered that components must have js files * ran all codemods this is all that's left * small changes to fix get needs two object, should not have been using get. * fix issue with one input in form field * fun times with set and onChange from oninput * fix issue with model not being passed through on secret-edit-display * fix issue with yarn run test not working, revert without npm run all * linting and small fix when loading without a selectAuthBackend * fix failing test with ui-wizard issue * fix test failure due to model not being asked for correctly with new changes, probably run into this more. * fix issue with component helper and at props specific to wizard * rename log to clilog due to conflict with new eslint rule * small changes for test failures * component helper at fixes * Revert to old component style something with new one broke this and can't figure it out for now * small fishy smelling test fixes will revisit * small test changes * more small test changes, appears upgrade treats spaces differently * comment out code and test that no longer seems relevant but confirm * clean run on component test though still some potential timing issues on ui-console test * fixing one auth test issue and timing issue on enable-test * small mods * fix this conditional check from upgrade * linting fixes after master merge * package updates using yarn upgrade-interactive * update libraries that did not effect any of the test failures. * update ember truth helpers library * settling tests * Fix ui-panel control group output * fix features selection test failures * Fix auth tests (x-vault-token) * fix shared test * fix issue with data null on backend * Revert "Fix auth tests (x-vault-token)" This reverts commit 89cb174b2f1998efa56d9604d14131415ae65d6f. * Fix auth tests (x-vault-token) without updating this.set * Update redirect-to tests * fix wrapped token test * skip some flaky test * fix issue with href and a tags vs buttons * fix linting * updates to get tests running (#10409) * yarn isntall * increasing resource_class * whoops * trying large * back to xlarge * Fix param issue on transform item routes * test fixes * settle on policies (old) test * fix browserstack test warning and skips of test confirmed worked * Fix redirect-to test * skips * fix transformation test and skip some kmip * Skip tests * Add meep marker to remaining failing tests * Skip test with failing component * rever skip on secret-create test * Skip piece of test that fails due to navigation-input * fix settings test where can and skip in others after confirming * fix circle ci test failures * ssh role settle * Fix navigate-input and add settled to test * Remove extra import * secret cubbyhole and alicloud * Add settled to gcpkms test * settles on redirect to test * Bump browserstack test resource to large * Update browserstack resource size to xlarge * update todos * add back in withTestWaiter * try and fix credentials conditional action added comment instead * Update volatile computed properies to get functions * this step was never reached and we never defined secretType anywhere so I removed * add settled to policy old test * Fix navigate-input on policies and leases * replace ssh test with no var hoping that helps and add settled to other failing tests, unskip console tests * kmip, transit, role test remove a skip and add in settled * fix hover copy button, had to remove some testing functionality * Remove private router service * remove skip on control ssh and ui panel, fix search select by restructuring how to read the error * final bit of working through skipped test * Replace clearNonGlobalModels by linking directly to namespace with href-to * Remove unused var * Fix role-ssh id bug by updating form-field-from-model to form-field-group-loop * Fix transit create id would not update * Update option toggle selector for ssh-role * Fix ssh selector * cleanup pt1 * small clean up * cleanup part2 * Fix computed on pricing-metrics-form * small cleanup based on chelseas comments. Co-authored-by: Chelsea Shaw <chelshaw.dev@gmail.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
388 lines
14 KiB
JavaScript
388 lines
14 KiB
JavaScript
import { clickTrigger } from 'ember-power-select/test-support/helpers';
|
|
import { click, fillIn, findAll, currentURL, find, visit, settled } from '@ember/test-helpers';
|
|
import { module, test } from 'qunit';
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
import authPage from 'vault/tests/pages/auth';
|
|
import { pollCluster } from 'vault/tests/helpers/poll-cluster';
|
|
import { create } from 'ember-cli-page-object';
|
|
import flashMessage from 'vault/tests/pages/components/flash-message';
|
|
import ss from 'vault/tests/pages/components/search-select';
|
|
|
|
const searchSelect = create(ss);
|
|
const flash = create(flashMessage);
|
|
|
|
const disableReplication = async (type, assert) => {
|
|
// disable performance replication
|
|
await visit(`/vault/replication/${type}`);
|
|
await settled();
|
|
if (findAll('[data-test-replication-link="manage"]').length) {
|
|
await click('[data-test-replication-link="manage"]');
|
|
await settled();
|
|
await click('[data-test-disable-replication] button');
|
|
|
|
const typeDisplay = type === 'dr' ? 'Disaster Recovery' : 'Performance';
|
|
await fillIn('[data-test-confirmation-modal-input="disable"]', typeDisplay);
|
|
await click('[data-test-confirm-button]');
|
|
await settled();
|
|
if (assert) {
|
|
assert.equal(currentURL(), `/vault/replication`, 'redirects to the replication page');
|
|
assert.equal(
|
|
flash.latestMessage,
|
|
'This cluster is having replication disabled. Vault will be unavailable for a brief period and will resume service shortly.',
|
|
'renders info flash when disabled'
|
|
);
|
|
}
|
|
await settled();
|
|
}
|
|
};
|
|
|
|
module('Acceptance | Enterprise | replication', function(hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(async function() {
|
|
await authPage.login();
|
|
await settled();
|
|
await disableReplication('dr');
|
|
await settled();
|
|
await disableReplication('performance');
|
|
await settled();
|
|
});
|
|
|
|
hooks.afterEach(async function() {
|
|
await disableReplication('dr');
|
|
await settled();
|
|
await disableReplication('performance');
|
|
await settled();
|
|
});
|
|
|
|
test('replication', async function(assert) {
|
|
const secondaryName = 'firstSecondary';
|
|
const mode = 'deny';
|
|
let mountPath;
|
|
|
|
// confirm unable to visit dr secondary details page when both replications are disabled
|
|
await visit('/vault/replication-dr-promote/details');
|
|
await settled();
|
|
assert.dom('[data-test-component="empty-state"]').exists();
|
|
assert
|
|
.dom('[data-test-empty-state-title]')
|
|
.includesText('Disaster Recovery secondary not set up', 'shows the correct title of the empty state');
|
|
|
|
assert
|
|
.dom('[data-test-empty-state-message]')
|
|
.hasText(
|
|
'This cluster has not been enabled as a Disaster Recovery Secondary. You can do so by enabling replication and adding a secondary from the Disaster Recovery Primary.',
|
|
'renders default message specific to when no replication is enabled'
|
|
);
|
|
|
|
await visit('/vault/replication');
|
|
await settled();
|
|
assert.equal(currentURL(), '/vault/replication');
|
|
|
|
// enable perf replication
|
|
await click('[data-test-replication-type-select="performance"]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await settled();
|
|
|
|
// confirm that the details dashboard shows
|
|
assert.dom('[data-test-replication-dashboard]').exists();
|
|
|
|
// add a secondary with a mount filter config
|
|
await click('[data-test-replication-link="secondaries"]');
|
|
await settled();
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-secondary-id]', secondaryName);
|
|
|
|
await click('#deny');
|
|
await clickTrigger();
|
|
mountPath = searchSelect.options.objectAt(0).text;
|
|
await searchSelect.options.objectAt(0).click();
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
|
|
await pollCluster(this.owner);
|
|
// click into the added secondary's mount filter config
|
|
await click('[data-test-replication-link="secondaries"]');
|
|
await settled();
|
|
await click('[data-test-popup-menu-trigger]');
|
|
|
|
await click('[data-test-replication-mount-filter-link]');
|
|
await settled();
|
|
assert.equal(currentURL(), `/vault/replication/performance/secondaries/config/show/${secondaryName}`);
|
|
assert.ok(
|
|
find('[data-test-mount-config-mode]')
|
|
.textContent.trim()
|
|
.toLowerCase()
|
|
.includes(mode),
|
|
'show page renders the correct mode'
|
|
);
|
|
assert
|
|
.dom('[data-test-mount-config-paths]')
|
|
.includesText(mountPath, 'show page renders the correct mount path');
|
|
|
|
// delete config by choosing "no filter" in the edit screen
|
|
await click('[data-test-replication-link="edit-mount-config"]');
|
|
await settled();
|
|
await click('#no-filtering');
|
|
await settled();
|
|
|
|
await click('[data-test-config-save]');
|
|
await settled();
|
|
assert.equal(
|
|
flash.latestMessage,
|
|
`The performance mount filter config for the secondary ${secondaryName} was successfully deleted.`,
|
|
'renders success flash upon deletion'
|
|
);
|
|
assert.equal(
|
|
currentURL(),
|
|
`/vault/replication/performance/secondaries`,
|
|
'redirects to the secondaries page'
|
|
);
|
|
// nav back to details page and confirm secondary is in the known secondaries table
|
|
await click('[data-test-replication-link="details"]');
|
|
await settled();
|
|
assert
|
|
.dom(`[data-test-secondaries=row-for-${secondaryName}]`)
|
|
.exists('shows a table row the recently added secondary');
|
|
|
|
// nav to DR
|
|
await visit('/vault/replication/dr');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'secondary');
|
|
assert
|
|
.dom('[data-test-replication-enable]')
|
|
.isDisabled('dr secondary enable is disabled when other replication modes are on');
|
|
|
|
// disable performance replication
|
|
await disableReplication('performance', assert);
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
|
|
// enable dr replication
|
|
await visit('vault/replication/dr');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await click('button[type="submit"]');
|
|
await settled();
|
|
|
|
await pollCluster(this.owner);
|
|
// empty state inside of know secondaries table
|
|
assert.dom('[data-test-empty-state-title]').exists();
|
|
assert
|
|
.dom('[data-test-empty-state-title]')
|
|
.includesText(
|
|
'No known dr secondary clusters associated with this cluster',
|
|
'shows the correct title of the empty state'
|
|
);
|
|
|
|
assert.ok(
|
|
find('[data-test-replication-title]').textContent.includes('Disaster Recovery'),
|
|
'it displays the replication type correctly'
|
|
);
|
|
assert.ok(
|
|
find('[data-test-replication-mode-display]').textContent.includes('primary'),
|
|
'it displays the cluster mode correctly'
|
|
);
|
|
|
|
// add dr secondary
|
|
await click('[data-test-replication-link="secondaries"]');
|
|
await settled();
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-secondary-id]', secondaryName);
|
|
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await click('[data-test-replication-link="secondaries"]');
|
|
await settled();
|
|
assert
|
|
.dom('[data-test-secondary-name]')
|
|
.includesText(secondaryName, 'it displays the secondary in the list of known secondaries');
|
|
});
|
|
|
|
test('disabling dr primary when perf replication is enabled', async function(assert) {
|
|
await visit('vault/replication/performance');
|
|
await settled();
|
|
// enable perf replication
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
|
|
// enable dr replication
|
|
await visit('/vault/replication/dr');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await settled();
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await visit('/vault/replication/dr/manage');
|
|
await settled();
|
|
await click('[data-test-demote-replication] [data-test-replication-action-trigger]');
|
|
await settled();
|
|
assert.ok(findAll('[data-test-demote-warning]').length, 'displays the demotion warning');
|
|
});
|
|
|
|
test('navigating to dr secondary details page when dr secondary is not enabled', async function(assert) {
|
|
// enable dr replication
|
|
|
|
await visit('/vault/replication/dr');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await visit('/vault/replication-dr-promote/details');
|
|
await settled();
|
|
|
|
assert.dom('[data-test-component="empty-state"]').exists();
|
|
assert
|
|
.dom('[data-test-empty-state-message]')
|
|
.hasText(
|
|
'This Disaster Recovery secondary has not been enabled. You can do so from the Disaster Recovery Primary.',
|
|
'renders message when replication is enabled'
|
|
);
|
|
});
|
|
|
|
test('add secondary and navigate through token generation modal', async function(assert) {
|
|
const secondaryNameFirst = 'firstSecondary';
|
|
const secondaryNameSecond = 'secondSecondary';
|
|
await visit('/vault/replication');
|
|
await settled();
|
|
// enable perf replication
|
|
await click('[data-test-replication-type-select="performance"]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await settled();
|
|
|
|
// add a secondary with default TTL
|
|
await click('[data-test-replication-link="secondaries"]');
|
|
await settled();
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-secondary-id]', secondaryNameFirst);
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
|
|
// checks on secondary token modal
|
|
assert.dom('#modal-wormhole').exists();
|
|
let modalDefaultTtl = document.querySelector('[data-test-row-value="TTL"]').innerText;
|
|
assert.equal(modalDefaultTtl, '1800s', 'shows the correct TTL of 1800s');
|
|
// click off the modal to make sure you don't just have to click on the copy-close button to copy the token
|
|
await click('[data-test-modal-background]');
|
|
await settled();
|
|
// add another secondary not using the default ttl
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-secondary-id]', secondaryNameSecond);
|
|
await click('[data-test-toggle-input]');
|
|
await settled();
|
|
await fillIn('[data-test-ttl-value]', 3);
|
|
await click('[data-test-secondary-add]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
|
|
let modalTtl = document.querySelector('[data-test-row-value="TTL"]').innerText;
|
|
assert.equal(modalTtl, '180s', 'shows the correct TTL of 180s');
|
|
await click('[data-test-modal-background]');
|
|
await settled();
|
|
// confirm you were redirected to the secondaries page
|
|
assert.equal(
|
|
currentURL(),
|
|
`/vault/replication/performance/secondaries`,
|
|
'redirects to the secondaries page'
|
|
);
|
|
assert
|
|
.dom('[data-test-secondary-name]')
|
|
.includesText(secondaryNameFirst, 'it displays the secondary in the list of secondaries');
|
|
});
|
|
|
|
test('render performance and dr primary and navigate to details page', async function(assert) {
|
|
// enable perf primary replication
|
|
await visit('/vault/replication');
|
|
await click('[data-test-replication-type-select="performance"]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await settled();
|
|
|
|
await visit('/vault/replication');
|
|
await settled();
|
|
assert
|
|
.dom(`[data-test-replication-summary-card]`)
|
|
.doesNotExist(`does not render replication summary card when both modes are not enabled as primary`);
|
|
|
|
// enable DR primary replication
|
|
const enableButton = document.querySelector('.is-primary');
|
|
|
|
await click(enableButton);
|
|
await settled();
|
|
await click('[data-test-replication-enable="true"]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await settled();
|
|
|
|
// navigate using breadcrumbs back to replication.index
|
|
await click('[data-test-replication-breadcrumb]');
|
|
await settled();
|
|
assert
|
|
.dom('[data-test-replication-summary-card]')
|
|
.exists({ count: 2 }, 'renders two replication-summary-card components');
|
|
|
|
// navigate to details page using the "Details" link
|
|
await click('[data-test-manage-link="Disaster Recovery"]');
|
|
await settled();
|
|
assert
|
|
.dom('[data-test-selectable-card-container="primary"]')
|
|
.exists('shows the correct card on the details dashboard');
|
|
assert.equal(currentURL(), '/vault/replication/dr');
|
|
});
|
|
|
|
test('render performance secondary and navigate to the details page', async function(assert) {
|
|
// enable perf replication
|
|
await visit('/vault/replication');
|
|
await settled();
|
|
await click('[data-test-replication-type-select="performance"]');
|
|
await settled();
|
|
await fillIn('[data-test-replication-cluster-mode-select]', 'primary');
|
|
await click('[data-test-replication-enable]');
|
|
await settled();
|
|
await pollCluster(this.owner);
|
|
await settled();
|
|
|
|
// demote perf primary to a secondary
|
|
await click('[data-test-replication-link="manage"]');
|
|
await settled();
|
|
// open demote modal
|
|
await click('[data-test-demote-replication] [data-test-replication-action-trigger]');
|
|
await settled();
|
|
// enter confirmation text
|
|
await fillIn('[data-test-confirmation-modal-input="demote"]', 'Performance');
|
|
// Click confirm button
|
|
await click('[data-test-confirm-button="demote"]');
|
|
await settled();
|
|
await click('[data-test-replication-link="details"]');
|
|
await settled();
|
|
assert.dom('[data-test-replication-dashboard]').exists();
|
|
assert.dom('[data-test-selectable-card-container="secondary"]').exists();
|
|
assert.ok(
|
|
find('[data-test-replication-mode-display]').textContent.includes('secondary'),
|
|
'it displays the cluster mode correctly'
|
|
);
|
|
});
|
|
});
|