From 00edf82c5d96d832f9ed28d17b9780fb1ba818b2 Mon Sep 17 00:00:00 2001 From: hashishaw Date: Fri, 10 Dec 2021 13:31:14 -0600 Subject: [PATCH 1/2] Fix managed namespace test --- ui/app/routes/vault/cluster.js | 4 ++-- ui/tests/acceptance/managed-namespace-test.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/app/routes/vault/cluster.js b/ui/app/routes/vault/cluster.js index ce4d17ff0014..c9b1c150f4d8 100644 --- a/ui/app/routes/vault/cluster.js +++ b/ui/app/routes/vault/cluster.js @@ -40,8 +40,8 @@ export default Route.extend(ModelBoundaryRoute, ClusterRoute, { const currentTokenName = this.auth.get('currentTokenName'); // if no namespace queryParam and user authenticated, // use user's root namespace to redirect to properly param'd url - if (this.featureFlagService.managedNamespaceRoot && !this.version.hasNamespaces) { - window.alert('Cannot use Cloud Admin Namespace flag with OSS Vault'); + if (this.featureFlagService.managedNamespaceRoot && this.version.isOss) { + console.error('Cannot use Cloud Admin Namespace flag with OSS Vault'); } if (!namespace && currentTokenName && !Ember.testing) { const storage = getStorage().getItem(currentTokenName); diff --git a/ui/tests/acceptance/managed-namespace-test.js b/ui/tests/acceptance/managed-namespace-test.js index 894d6d1ab651..94a4db60adde 100644 --- a/ui/tests/acceptance/managed-namespace-test.js +++ b/ui/tests/acceptance/managed-namespace-test.js @@ -2,6 +2,7 @@ import { module, test } from 'qunit'; import { currentURL, visit, fillIn } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import Pretender from 'pretender'; +import logout from 'vault/tests/pages/logout'; const FEATURE_FLAGS_RESPONSE = { feature_flags: ['VAULT_CLOUD_ADMIN_NAMESPACE'], @@ -23,6 +24,7 @@ module('Acceptance | Enterprise | Managed namespace root', function(hooks) { this.get('/v1/sys/health', this.passthrough); this.get('/v1/sys/seal-status', this.passthrough); this.get('/v1/sys/license/features', this.passthrough); + this.get('/v1/sys/internal/ui/mounts', this.passthrough); }); }); @@ -31,8 +33,11 @@ module('Acceptance | Enterprise | Managed namespace root', function(hooks) { }); test('it shows the managed namespace toolbar when feature flag exists', async function(assert) { + await logout.visit(); await visit('/vault/auth'); - assert.equal(currentURL(), '/vault/auth?namespace=admin&with=token', 'Redirected to base namespace'); + console.log(currentURL(), 'current'); + assert.ok(currentURL().startsWith('/vault/auth'), 'Redirected to auth'); + assert.ok(currentURL().includes('?namespace=admin'), 'with base namespace'); assert.dom('[data-test-namespace-toolbar]').doesNotExist('Normal namespace toolbar does not exist'); assert.dom('[data-test-managed-namespace-toolbar]').exists('Managed namespace toolbar exists'); From c05a20e57ef7f2bb6be2f72c4a2f5e5d4f14e599 Mon Sep 17 00:00:00 2001 From: hashishaw Date: Fri, 10 Dec 2021 14:13:07 -0600 Subject: [PATCH 2/2] Remove log --- ui/tests/acceptance/managed-namespace-test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/tests/acceptance/managed-namespace-test.js b/ui/tests/acceptance/managed-namespace-test.js index 94a4db60adde..5a7868bc677b 100644 --- a/ui/tests/acceptance/managed-namespace-test.js +++ b/ui/tests/acceptance/managed-namespace-test.js @@ -35,7 +35,6 @@ module('Acceptance | Enterprise | Managed namespace root', function(hooks) { test('it shows the managed namespace toolbar when feature flag exists', async function(assert) { await logout.visit(); await visit('/vault/auth'); - console.log(currentURL(), 'current'); assert.ok(currentURL().startsWith('/vault/auth'), 'Redirected to auth'); assert.ok(currentURL().includes('?namespace=admin'), 'with base namespace');