Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix managed namespace test #13394

Merged
merged 2 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/app/routes/vault/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion ui/tests/acceptance/managed-namespace-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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);
});
});

Expand All @@ -31,8 +33,10 @@ 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');
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');
Expand Down