mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 01:32:33 +00:00
UI: Fix ACME Account Safety Buffer not able to be turned off (#27742)
* test coverage for bug * Add defaultValue to acmeAccountSafetyBuffer * fix failing PKI tests * Add changelog
This commit is contained in:
3
changelog/27742.txt
Normal file
3
changelog/27742.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
ui: fix issue where enabling then disabling "Tidy ACME" in PKI results in failed API call.
|
||||
```
|
||||
@@ -21,6 +21,7 @@ export default class PkiTidyModel extends Model {
|
||||
'The amount of time that must pass after creation that an account with no orders is marked revoked, and the amount of time after being marked revoked or deactivated.',
|
||||
detailsLabel: 'ACME account safety buffer',
|
||||
formatTtl: true,
|
||||
defaultValue: '720h',
|
||||
})
|
||||
acmeAccountSafetyBuffer;
|
||||
|
||||
|
||||
@@ -143,6 +143,33 @@ module('Acceptance | pki tidy', function (hooks) {
|
||||
assert.strictEqual(currentRouteName(), 'vault.cluster.secrets.backend.pki.tidy.auto.index');
|
||||
});
|
||||
|
||||
// test coverage for a bug where toggling acme tidy on then off caused API failure
|
||||
test('it configures a manual tidy operation', async function (assert) {
|
||||
await authPage.login(this.pkiAdminToken);
|
||||
await visit(`/vault/secrets/${this.mountPath}/pki/tidy`);
|
||||
await click(PKI_TIDY.tidyEmptyStateConfigure);
|
||||
assert.dom(PKI_TIDY.tidyConfigureModal.configureTidyModal).exists();
|
||||
assert.dom(PKI_TIDY.tidyConfigureModal.tidyModalAutoButton).exists();
|
||||
assert.dom(PKI_TIDY.tidyConfigureModal.tidyModalManualButton).exists();
|
||||
await click(PKI_TIDY.tidyConfigureModal.tidyModalManualButton);
|
||||
|
||||
assert.dom(PKI_TIDY_FORM.tidyFormName('manual')).exists();
|
||||
await click(PKI_TIDY_FORM.inputByAttr('tidyCertStore'));
|
||||
|
||||
await click(GENERAL.ttl.toggle('Tidy ACME disabled'));
|
||||
assert
|
||||
.dom(GENERAL.ttl.input('Tidy ACME enabled'))
|
||||
.hasValue('30', 'acmeAccountSafetyBuffer defaults to 30 days');
|
||||
await click('[data-test-toggle-input="Tidy ACME enabled"]');
|
||||
|
||||
await click(PKI_TIDY_FORM.tidySave);
|
||||
assert.strictEqual(
|
||||
currentRouteName(),
|
||||
'vault.cluster.secrets.backend.pki.tidy.index',
|
||||
'saves successfully and redirects to index'
|
||||
);
|
||||
});
|
||||
|
||||
test('it opens a tidy modal when the user clicks on the tidy toolbar action', async function (assert) {
|
||||
await authPage.login(this.pkiAdminToken);
|
||||
await visit(`/vault/secrets/${this.mountPath}/pki/tidy`);
|
||||
|
||||
@@ -180,7 +180,7 @@ module('Integration | Component | pki tidy form', function (hooks) {
|
||||
assert.propEqual(
|
||||
JSON.parse(req.requestBody),
|
||||
{
|
||||
acme_account_safety_buffer: '60s',
|
||||
acme_account_safety_buffer: '72h',
|
||||
enabled: true,
|
||||
interval_duration: '10s',
|
||||
issuer_safety_buffer: '20s',
|
||||
@@ -230,7 +230,7 @@ module('Integration | Component | pki tidy form', function (hooks) {
|
||||
assert.false(this.autoTidy.tidyAcme, 'tidyAcme is false on model');
|
||||
|
||||
await click(PKI_TIDY_FORM.toggleInput('acmeAccountSafetyBuffer'));
|
||||
await fillIn(PKI_TIDY_FORM.acmeAccountSafetyBuffer, 60);
|
||||
await fillIn(PKI_TIDY_FORM.acmeAccountSafetyBuffer, 3); // units are days based on defaultValue
|
||||
assert.true(this.autoTidy.tidyAcme, 'tidyAcme toggles to true');
|
||||
|
||||
const fillInValues = {
|
||||
@@ -262,6 +262,7 @@ module('Integration | Component | pki tidy form', function (hooks) {
|
||||
assert.propEqual(
|
||||
JSON.parse(req.requestBody),
|
||||
{
|
||||
acme_account_safety_buffer: '720h',
|
||||
enabled: false,
|
||||
tidy_acme: false,
|
||||
},
|
||||
@@ -294,7 +295,7 @@ module('Integration | Component | pki tidy form', function (hooks) {
|
||||
assert.ok(true, 'Request made to perform manual tidy');
|
||||
assert.propEqual(
|
||||
JSON.parse(req.requestBody),
|
||||
{ tidy_acme: false },
|
||||
{ acme_account_safety_buffer: '720h', tidy_acme: false },
|
||||
'response contains manual tidy params'
|
||||
);
|
||||
return { id: 'pki-manual-tidy' };
|
||||
|
||||
Reference in New Issue
Block a user