diff --git a/changelog/11011.txt b/changelog/11011.txt new file mode 100644 index 0000000000..c87fe50d12 --- /dev/null +++ b/changelog/11011.txt @@ -0,0 +1,3 @@ +```changelog:bug +ui: Fix KMIP failing test and a bug that ocurred because the configuration model was not being unloaded. +``` diff --git a/ui/lib/kmip/addon/routes/configuration.js b/ui/lib/kmip/addon/routes/configuration.js index cf7227451b..4e25f3a1dd 100644 --- a/ui/lib/kmip/addon/routes/configuration.js +++ b/ui/lib/kmip/addon/routes/configuration.js @@ -1,7 +1,8 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; +import UnloadModel from 'vault/mixins/unload-model-route'; -export default Route.extend({ +export default Route.extend(UnloadModel, { store: service(), secretMountPath: service(), pathHelp: service(), diff --git a/ui/tests/acceptance/enterprise-kmip-test.js b/ui/tests/acceptance/enterprise-kmip-test.js index 6f9812a313..9c2e68cb47 100644 --- a/ui/tests/acceptance/enterprise-kmip-test.js +++ b/ui/tests/acceptance/enterprise-kmip-test.js @@ -1,4 +1,4 @@ -import { currentURL, currentRouteName, settled } from '@ember/test-helpers'; +import { currentURL, currentRouteName, settled, fillIn } from '@ember/test-helpers'; import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; import { create } from 'ember-cli-page-object'; @@ -12,10 +12,16 @@ import mountSecrets from 'vault/tests/pages/settings/mount-secret-backend'; const uiConsole = create(consoleClass); +const getRandomPort = () => { + let a = Math.floor(100000 + Math.random() * 900000); + a = String(a); + return a.substring(0, 4); +}; + const mount = async (shouldConfig = true) => { const now = Date.now(); let path = `kmip-${now}`; - let addr = `127.0.0.1:${now % 1000}`; // use random port + let addr = `127.0.0.1:${getRandomPort()}`; // use random port let commands = shouldConfig ? [`write sys/mounts/${path} type=kmip`, `write ${path}/config listen_addrs=${addr}`] : [`write sys/mounts/${path} type=kmip`]; @@ -99,6 +105,8 @@ module('Acceptance | Enterprise | KMIP secrets', function(hooks) { `/vault/secrets/${path}/kmip/configure`, 'configuration navigates to the configure page' ); + let addr = `127.0.0.1:${getRandomPort()}`; + await fillIn('[data-test-string-list-input="0"]', addr); await scopesPage.submit(); await settled();