mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-09 08:55:13 -04:00
UI: Fix flaky secrets-sync test with optional chaining (#31176)
* UI: Fix flaky secrets-sync test with optional chaining
* resolve timing issues by moving cleanup directly to test and stubbing endpoint instead of relying on req.passthrough()
* Revert "UI: Fix flaky secrets-sync test with optional chaining"
This reverts commit 3e170db4a3.
* add data wrappers & reset hvd flag before deleting the admin namespace
---------
Co-authored-by: claire bontempo <cbontempo@hashicorp.com>
This commit is contained in:
parent
eee353e40b
commit
0ee8d99d9c
1 changed files with 34 additions and 12 deletions
|
|
@ -168,11 +168,6 @@ module('Acceptance | sync | overview', function (hooks) {
|
|||
await loginNs('admin/foo');
|
||||
});
|
||||
|
||||
hooks.afterEach(async function () {
|
||||
await visit('vault/dashboard');
|
||||
await runCmd([`delete admin/sys/namespaces/foo -f`, deleteNS('admin')]);
|
||||
});
|
||||
|
||||
test('it should make activation-flag requests to correct namespace', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
|
|
@ -201,14 +196,25 @@ module('Acceptance | sync | overview', function (hooks) {
|
|||
await click(ts.overview.activationModal.checkbox);
|
||||
await click(ts.overview.activationModal.confirm);
|
||||
|
||||
// During the afterEach hook cleanup endpoint is hit again which increases the assertion count (above)
|
||||
// Re-stub here without the assertion to prep for namespace cleanup.
|
||||
this.server.get('/sys/activation-flags', (_, req) => req.passthrough());
|
||||
// During the namespace cleanup in the afterEach hook this endpoint is hit again which increases the assertion count (above)
|
||||
// Re-stub here without the assertion to reduce unnecessary assertions.
|
||||
this.server.get('/sys/activation-flags', () => {
|
||||
return {
|
||||
data: {
|
||||
activated: ['secrets-sync'],
|
||||
unactivated: [],
|
||||
},
|
||||
};
|
||||
});
|
||||
await visit('vault/dashboard');
|
||||
await runCmd([`delete admin/sys/namespaces/foo -f`, deleteNS('admin')]);
|
||||
});
|
||||
|
||||
test('it should make activation-flag requests to correct namespace when managed', async function (assert) {
|
||||
assert.expect(3);
|
||||
this.owner.lookup('service:flags').featureFlags = ['VAULT_CLOUD_ADMIN_NAMESPACE'];
|
||||
|
||||
const flagService = this.owner.lookup('service:flags');
|
||||
flagService.featureFlags = ['VAULT_CLOUD_ADMIN_NAMESPACE'];
|
||||
|
||||
this.server.get('/sys/activation-flags', (_, req) => {
|
||||
assert.deepEqual(req.requestHeaders, {}, 'Request is unauthenticated and in root namespace');
|
||||
|
|
@ -236,9 +242,25 @@ module('Acceptance | sync | overview', function (hooks) {
|
|||
await click(ts.overview.activationModal.checkbox);
|
||||
await click(ts.overview.activationModal.confirm);
|
||||
|
||||
// During the afterEach hook this endpoint is hit again which increases the assertion count (above)
|
||||
// Re-stub here without the assertion to prep for namespace cleanup.
|
||||
this.server.get('/sys/activation-flags', (_, req) => req.passthrough());
|
||||
// During the namespace cleanup in the afterEach hook this endpoint is hit again which increases the assertion count (above)
|
||||
// Re-stub here without the assertion to reduce unnecessary assertions.
|
||||
this.server.get('/sys/activation-flags', () => {
|
||||
return {
|
||||
data: {
|
||||
activated: ['secrets-sync'],
|
||||
unactivated: [],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// Delete the admin/foo namespace
|
||||
await visit('vault/dashboard');
|
||||
await runCmd([deleteNS('foo')]);
|
||||
|
||||
// Reset the HVD feature flag so that we can delete the admin namespace
|
||||
flagService.featureFlags = [];
|
||||
await login();
|
||||
await runCmd([deleteNS('admin')]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue