UI: fix KMIP bug and test (#11011)

* fix KMIP test that was failing and clean modal on configuration page.

* add changelog

* remove uncessary unload

* remove async
This commit is contained in:
Angel Garbarino 2021-02-25 15:13:00 -07:00 committed by GitHub
parent 81199004e6
commit 8bb439fc7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

3
changelog/11011.txt Normal file
View File

@ -0,0 +1,3 @@
```changelog:bug
ui: Fix KMIP failing test and a bug that ocurred because the configuration model was not being unloaded.
```

View File

@ -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(),

View File

@ -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();