Main to session recording (#178)
* fix: 🐛 add model hook to host route for dynamic host catalogs (#1659) * fix: 🐛 add model hook to host route for dynamic host catalogs ✅ Closes: ICU-8594 * refactor: 💡 remove page formatting for host route * [COMPLIANCE] Add Copyright and License Headers (#1660) Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Carlos Alcaide Corvo <ccorvo@hashicorp.com> * chore(deps-dev): bump webpack from 5.59.1 to 5.76.0 (#1654) Bumps [webpack](https://github.com/webpack/webpack) from 5.59.1 to 5.76.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.59.1...v5.76.0) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Randall Morey <randall@randallmorey.com> Co-authored-by: Carlos Alcaide Corvo <ccorvo@hashicorp.com> * Feature metadata (#1661) * feat: 🎸 load edition from controller-metadata.json * refactor: 💡 rename edition and add licensed features support * chore: 🤖 support dev toggling of licensed features * chore: 🤖 rename ent edition * Update ui/admin/app/services/feature-edition.js * Update ui/admin/app/instance-initializers/feature-edition.js Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * chore: 🤖 cleanup * chore: 🤖 feature edition disabled in tests / fix test cases * test: 💍 remove feature disable calls in tests * test: 💍 fix broken tests * fix: 🐛 fix config bug * fix: 🐛 fix broken test due to feature flags --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * chore: 🤖 yarn.lock update * fix: 🐛 fix test features --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: lisbet-alvarez <107949262+lisbet-alvarez@users.noreply.github.com> Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Carlos Alcaide Corvo <ccorvo@hashicorp.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> Co-authored-by: github-team-secure-boundary <hc-github-team-secure-boundary@hashicorp.com> Co-authored-by: hc-github-team-secure-boundary <82989682+hc-github-team-secure-boundary@users.noreply.github.com>
This commit is contained in:
40 files changed
+351
-335
No files matched your search
@@ -23,6 +23,7 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let featuresService;
|
||||
let getCredentialLibraryCount;
|
||||
|
||||
const instances = {
|
||||
@@ -76,6 +77,7 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
getCredentialLibraryCount = () =>
|
||||
this.server.schema.credentialLibraries.all().models.length;
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
test('visiting credential libraries', async function (assert) {
|
||||
assert.expect(2);
|
||||
@@ -98,6 +100,7 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
|
||||
test('can create a new credential library of type vault ssh cert', async function (assert) {
|
||||
assert.expect(12);
|
||||
featuresService.enable('ssh-target');
|
||||
const count = getCredentialLibraryCount();
|
||||
await visit(urls.newCredentialLibrary);
|
||||
await click('[value="vault-ssh-certificate"]');
|
||||
@@ -156,6 +159,7 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
|
||||
test('ecdsa and rsa key types bring up a key bits field', async function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('ssh-target');
|
||||
await visit(urls.newCredentialLibrary);
|
||||
await click('[value="vault-ssh-certificate"]');
|
||||
await select('[name="key_type"]', 'ed25519');
|
||||
@@ -224,11 +228,9 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot select vault ssh cert when feature is disabled', async function (assert) {
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('ssh-target');
|
||||
assert.expect(1);
|
||||
assert.expect(2);
|
||||
await visit(urls.newCredentialLibrary);
|
||||
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.dom('[value="vault-ssh-certificate"]').doesNotExist();
|
||||
});
|
||||
});
|
||||
@@ -85,7 +85,7 @@ module('Acceptance | credential-libraries | read', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot navigate to vault ssh cert form when feature is not enabled', async function (assert) {
|
||||
assert.expect(1);
|
||||
assert.expect(2);
|
||||
instances.credentialLibrary = this.server.create('credential-library', {
|
||||
scope: instances.scopes.project,
|
||||
credentialStore: instances.credentialStore,
|
||||
@@ -94,10 +94,9 @@ module('Acceptance | credential-libraries | read', function (hooks) {
|
||||
await visit(
|
||||
`${urls.credentialLibraries}/${instances.credentialLibrary.id}`
|
||||
);
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('ssh-target');
|
||||
await visit(urls.credentialLibraries);
|
||||
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.dom('.rose-table-body tr:nth-of-type(2) a').doesNotExist();
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ module('Acceptance | credential-stores | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let featuresService;
|
||||
let getCredentialStoresCount;
|
||||
let getStaticCredentialStoresCount;
|
||||
let getVaultCredentialStoresCount;
|
||||
@@ -62,10 +63,12 @@ module('Acceptance | credential-stores | create', function (hooks) {
|
||||
.length;
|
||||
};
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('Users can create a new credential store of default type static', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('static-credentials');
|
||||
const count = getStaticCredentialStoresCount();
|
||||
await visit(urls.newCredentialStore);
|
||||
await fillIn('[name="name"]', 'random string');
|
||||
@@ -75,6 +78,7 @@ module('Acceptance | credential-stores | create', function (hooks) {
|
||||
|
||||
test('Users can create a new credential store of type vault', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('static-credentials');
|
||||
const count = getVaultCredentialStoresCount();
|
||||
await visit(urls.newCredentialStore);
|
||||
await fillIn('[name="name"]', 'random string');
|
||||
|
||||
@@ -117,6 +117,7 @@ module(
|
||||
|
||||
test('users can create a new json credential', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('json-credentials');
|
||||
const credentialsCount = getCredentialsCount();
|
||||
const jsonCredentialCount = getJsonCredentialCount();
|
||||
await visit(urls.credentials);
|
||||
@@ -159,6 +160,7 @@ module(
|
||||
|
||||
test('users can cancel create new json credential', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('json-credentials');
|
||||
const credentialsCount = getCredentialsCount();
|
||||
await visit(urls.credentials);
|
||||
|
||||
@@ -173,6 +175,7 @@ module(
|
||||
|
||||
test('users can switch away from JSON type credentials and the json_object value will be cleared', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('json-credentials');
|
||||
const editorSelector = '[data-test-code-editor-field-editor]';
|
||||
const newSecret = '{"test": "value"}';
|
||||
|
||||
@@ -191,6 +194,7 @@ module(
|
||||
|
||||
test('users cannot navigate to new credential route without proper authorization', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('static-credentials');
|
||||
instances.staticCredentialStore.authorized_collection_actions.credentials =
|
||||
instances.staticCredentialStore.authorized_collection_actions.credentials.filter(
|
||||
(item) => {
|
||||
@@ -282,6 +286,7 @@ module(
|
||||
|
||||
test('saving a new json credential with invalid fields displays error messages', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('json-credentials');
|
||||
await visit(urls.credentials);
|
||||
this.server.post('/credentials', () => {
|
||||
return new Response(
|
||||
@@ -313,12 +318,11 @@ module(
|
||||
});
|
||||
|
||||
test('cannot navigate to json credential when feature is disabled', async function (assert) {
|
||||
featuresService.disable('json-credentials');
|
||||
assert.expect(4);
|
||||
assert.expect(5);
|
||||
await visit(urls.credentials);
|
||||
|
||||
await click(`[href="${urls.newCredential}"]`);
|
||||
|
||||
assert.false(featuresService.isEnabled('json-credentials'));
|
||||
assert.true(
|
||||
instances.staticCredentialStore.authorized_collection_actions.credentials.includes(
|
||||
'create'
|
||||
|
||||
@@ -14,6 +14,8 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
org: null,
|
||||
@@ -75,6 +77,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
|
||||
urls.jsonCredential = `${urls.credentials}/${instances.jsonCredential.id}`;
|
||||
urls.unknownCredential = `${urls.credentials}/foo`;
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('visiting username & password credential', async function (assert) {
|
||||
@@ -101,6 +104,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
|
||||
|
||||
test('visiting JSON credential', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('json-credentials');
|
||||
await visit(urls.staticCredentialStore);
|
||||
await click(`[href="${urls.credentials}"]`);
|
||||
await a11yAudit();
|
||||
@@ -141,10 +145,9 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot navigate to a JSON credential form when feature not enabled', async function (assert) {
|
||||
assert.expect(1);
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('json-credentials');
|
||||
assert.expect(2);
|
||||
await visit(urls.credentials);
|
||||
assert.false(featuresService.isEnabled('json-credentials'));
|
||||
assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist();
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ module('Acceptance | credential-stores | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
@@ -63,10 +65,12 @@ module('Acceptance | credential-stores | read', function (hooks) {
|
||||
urls.unknownCredentialStore = `${urls.credentialStores}/foo`;
|
||||
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('visiting static credential store', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('static-credentials');
|
||||
await visit(urls.credentialStores);
|
||||
await a11yAudit();
|
||||
assert.strictEqual(currentURL(), urls.credentialStores);
|
||||
@@ -104,6 +108,7 @@ module('Acceptance | credential-stores | read', function (hooks) {
|
||||
|
||||
test('cannot navigate to a vault credential store form without proper authorization', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('static-credentials');
|
||||
await visit(urls.projectScope);
|
||||
instances.vaultCredentialStore.authorized_actions =
|
||||
instances.vaultCredentialStore.authorized_actions.filter(
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, getContext } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
@@ -15,12 +20,14 @@ module('Acceptance | develop', function (hooks) {
|
||||
});
|
||||
|
||||
test('edition toggle is hidden when `dev-edition-toggle` is false', async function (assert) {
|
||||
assert.expect(2);
|
||||
await visit('/');
|
||||
assert.false(featuresService.isEnabled('dev-edition-toggle'));
|
||||
assert.dom('data-dev-edition-toggle').doesNotExist();
|
||||
});
|
||||
|
||||
test('edition toggle is visible when `dev-edition-toggle` is true', async function (assert) {
|
||||
assert.expect(2);
|
||||
assert.false(featuresService.isEnabled('dev-edition-toggle'));
|
||||
featuresService.enable('dev-edition-toggle');
|
||||
await visit('/');
|
||||
|
||||
@@ -9,6 +9,8 @@ module('Acceptance | session recordings | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
// Selectors
|
||||
const LIST_SESSION_RECORDING_BUTTON =
|
||||
'table > tbody > tr > td:last-child > a';
|
||||
@@ -51,26 +53,26 @@ module('Acceptance | session recordings | read', function (hooks) {
|
||||
urls.sessionRecording = `${urls.sessionRecordings}/${instances.sessionRecording.id}`;
|
||||
urls.channelRecording = `${urls.sessionRecording}/channels-by-connection/${instances.channelRecording.id}`;
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('visiting a session recording', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('session-recording');
|
||||
// Visit session recordings
|
||||
await visit(urls.sessionRecordings);
|
||||
await a11yAudit();
|
||||
|
||||
// Click a session recording and check it navigates properly
|
||||
await click(LIST_SESSION_RECORDING_BUTTON);
|
||||
await a11yAudit();
|
||||
|
||||
assert.strictEqual(currentURL(), urls.sessionRecording);
|
||||
});
|
||||
|
||||
test('user can navigate to a session recording with proper authorization', async function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('session-recording');
|
||||
// Visit session recordings
|
||||
await visit(urls.sessionRecordings);
|
||||
|
||||
assert.true(instances.sessionRecording.authorized_actions.includes('read'));
|
||||
assert.dom(`[href="${urls.sessionRecording}"]`).exists();
|
||||
// Click a session recording and check it navigates properly
|
||||
@@ -80,11 +82,11 @@ module('Acceptance | session recordings | read', function (hooks) {
|
||||
|
||||
test('user cannot navigate to a session recording without the read action', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('session-recording');
|
||||
instances.sessionRecording.authorized_actions =
|
||||
instances.sessionRecording.authorized_actions.filter(
|
||||
(item) => item !== 'read'
|
||||
);
|
||||
|
||||
// Visit session recordings
|
||||
await visit(urls.sessionRecordings);
|
||||
assert.dom(LIST_SESSION_RECORDING_BUTTON).doesNotExist();
|
||||
@@ -92,7 +94,7 @@ module('Acceptance | session recordings | read', function (hooks) {
|
||||
|
||||
test('user can navigate to a channel recording', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
featuresService.enable('session-recording');
|
||||
// Visit session recording
|
||||
await visit(urls.sessionRecording);
|
||||
assert.dom('table').hasClass('hds-table');
|
||||
|
||||
@@ -13,7 +13,7 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let features;
|
||||
let featuresService;
|
||||
let intl;
|
||||
|
||||
const STORAGE_BUCKET_TITLE = 'Storage Buckets';
|
||||
@@ -46,14 +46,14 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
urls.storageBuckets = `${urls.globalScope}/storage-buckets`;
|
||||
|
||||
intl = this.owner.lookup('service:intl');
|
||||
features = this.owner.lookup('service:features');
|
||||
features.enable('session-recording');
|
||||
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('users can navigate to storage-buckets with proper authorization', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
featuresService.enable('session-recording');
|
||||
await visit(urls.globalScope);
|
||||
|
||||
assert.true(
|
||||
@@ -79,6 +79,9 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
|
||||
test('user cannot navigate to index without either list or create actions', async function (assert) {
|
||||
assert.expect(5);
|
||||
featuresService.enable('byow');
|
||||
featuresService.enable('session-recording');
|
||||
|
||||
instances.scopes.global.authorized_collection_actions['storage-buckets'] =
|
||||
[];
|
||||
|
||||
@@ -111,6 +114,8 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
|
||||
test('user can navigate to index with only create action', async function (assert) {
|
||||
assert.expect(5);
|
||||
featuresService.enable('session-recording');
|
||||
|
||||
instances.scopes.global.authorized_collection_actions['storage-buckets'] =
|
||||
instances.scopes.global.authorized_collection_actions[
|
||||
'storage-buckets'
|
||||
@@ -143,6 +148,8 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
|
||||
test('user can navigate to index with only list action', async function (assert) {
|
||||
assert.expect(5);
|
||||
featuresService.enable('session-recording');
|
||||
|
||||
instances.scopes.global.authorized_collection_actions['storage-buckets'] =
|
||||
instances.scopes.global.authorized_collection_actions[
|
||||
'storage-buckets'
|
||||
@@ -172,11 +179,10 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
});
|
||||
|
||||
test('user cannot navigate to index when feature is disabled', async function (assert) {
|
||||
assert.expect(1);
|
||||
features.disable('session-recording');
|
||||
|
||||
assert.expect(2);
|
||||
featuresService.enable('byow');
|
||||
await visit(urls.globalScope);
|
||||
|
||||
assert.false(featuresService.isEnabled('session-recording'));
|
||||
assert
|
||||
.dom('[title="General"] a:nth-of-type(2)')
|
||||
.doesNotIncludeText(STORAGE_BUCKET_TITLE);
|
||||
@@ -184,6 +190,7 @@ module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
|
||||
test('edit action in table directs user to appropriate page', async function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('session-recording');
|
||||
await visit(urls.globalScope);
|
||||
instances.storageBucket = this.server.create('storage-bucket', {
|
||||
scope: instances.scopes.global,
|
||||
|
||||
@@ -148,14 +148,13 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot navigate to a json type credential when feature is disabled', async function (assert) {
|
||||
featuresService.disable('json-credentials');
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
const jsonCredential = instances.credentials[2];
|
||||
instances.target.update({
|
||||
brokeredCredentialSourceIds: [...randomlySelectedCredentials],
|
||||
});
|
||||
await visit(urls.brokeredCredentialSources);
|
||||
|
||||
assert.false(featuresService.isEnabled('json-credentials'));
|
||||
assert
|
||||
.dom('.rose-table-row:nth-child(3)')
|
||||
.includesText(jsonCredential.name);
|
||||
|
||||
@@ -85,13 +85,17 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
|
||||
test('defaults to type `ssh` when no query param provided', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('ssh-target');
|
||||
await visit(urls.newTarget);
|
||||
assert.strictEqual(find('[name="type"]:checked').value, TYPE_TARGET_SSH);
|
||||
});
|
||||
|
||||
test('can create type `ssh` when `target-worker-filters-v2` is disabled', async function (assert) {
|
||||
featuresService.disable('target-worker-filters-v2');
|
||||
assert.expect(4);
|
||||
assert.expect(5);
|
||||
featuresService.enable('ssh-target');
|
||||
|
||||
assert.false(featuresService.isEnabled('target-worker-filters-v2'));
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const sshTargetCount = getSSHTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -116,8 +120,10 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('can create type `ssh` when `target-worker-filters-v2` is enabled', async function (assert) {
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
assert.expect(4);
|
||||
featuresService.enable('ssh-target');
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const sshTargetCount = getSSHTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -146,8 +152,11 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('can create type `tcp` when `target-worker-filters-v2` is disabled', async function (assert) {
|
||||
featuresService.disable('target-worker-filters-v2');
|
||||
assert.expect(4);
|
||||
assert.expect(5);
|
||||
featuresService.enable('ssh-target');
|
||||
|
||||
assert.false(featuresService.isEnabled('target-worker-filters-v2'));
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const tcpTargetCount = getTCPTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -172,8 +181,10 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('can create type `tcp` when `target-worker-filters-v2` is enabled', async function (assert) {
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
assert.expect(4);
|
||||
featuresService.enable('ssh-target');
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const tcpTargetCount = getTCPTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -203,9 +214,11 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('can create type `tcp` when `target-worker-filters-v2` and `target-worker-filters-v2-ingress` is enabled', async function (assert) {
|
||||
assert.expect(4);
|
||||
featuresService.enable('ssh-target');
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
featuresService.enable('target-worker-filters-v2-ingress');
|
||||
assert.expect(4);
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const tcpTargetCount = getTCPTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -239,15 +252,16 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
|
||||
test('default port is not marked required for SSH targets', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('ssh-target');
|
||||
await visit(urls.newTarget);
|
||||
assert.dom('[data-test-default-port-label]').includesText('Optional');
|
||||
});
|
||||
|
||||
test('default port is marked required for TCP targets', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('ssh-target');
|
||||
await visit(urls.newTarget);
|
||||
await click('[value="tcp"]');
|
||||
|
||||
assert.dom('[data-test-default-port-label]').includesText('Required');
|
||||
});
|
||||
|
||||
@@ -284,12 +298,11 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot navigate to new SSH targets route when ssh feature is disabled', async function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.disable('ssh-target');
|
||||
assert.expect(4);
|
||||
await visit(urls.targets);
|
||||
|
||||
await click(`[href="${urls.newTarget}"]`);
|
||||
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.true(
|
||||
instances.scopes.project.authorized_collection_actions.targets.includes(
|
||||
'create'
|
||||
@@ -301,6 +314,9 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
|
||||
test('can cancel create new TCP target', async function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
featuresService.enable('target-worker-filters-v2-ingress');
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const tcpTargetCount = getTCPTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -321,6 +337,10 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
|
||||
test('can cancel create new SSH target', async function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('ssh-target');
|
||||
featuresService.enable('target-worker-filters-v2');
|
||||
featuresService.enable('target-worker-filters-v2-ingress');
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
const sshTargetCount = getSSHTargetCount();
|
||||
await visit(urls.targets);
|
||||
@@ -398,10 +418,13 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
|
||||
test('can save address', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('target-network-address');
|
||||
|
||||
const targetCount = getTargetCount();
|
||||
await visit(urls.targets);
|
||||
|
||||
await click(`[href="${urls.newTarget}"]`);
|
||||
|
||||
await fillIn('[name="name"]', 'random string');
|
||||
await fillIn('[name="address"]', '0.0.0.0');
|
||||
await click('[type="submit"]');
|
||||
@@ -414,12 +437,10 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('address field does not exist when target network address feature is disabled', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.disable('target-network-address');
|
||||
assert.expect(2);
|
||||
await visit(urls.targets);
|
||||
|
||||
await click(`[href="${urls.newTarget}"]`);
|
||||
|
||||
assert.false(featuresService.isEnabled('target-network-address'));
|
||||
assert.dom('[name="address"]').doesNotExist();
|
||||
});
|
||||
});
|
||||
@@ -76,6 +76,8 @@ module('Acceptance | targets | read', function (hooks) {
|
||||
|
||||
test('visiting ssh target', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('ssh-target');
|
||||
|
||||
await visit(urls.targets);
|
||||
await a11yAudit();
|
||||
assert.strictEqual(currentURL(), urls.targets);
|
||||
@@ -134,23 +136,22 @@ module('Acceptance | targets | read', function (hooks) {
|
||||
});
|
||||
|
||||
test('visiting an ssh target does not show the worker_filter deprecation message when "target-worker-filters-v2" is disabled', async function (assert) {
|
||||
featuresService.disable('target-worker-filters-v2');
|
||||
assert.expect(1);
|
||||
assert.expect(2);
|
||||
await visit(urls.sshTarget);
|
||||
|
||||
assert.false(featuresService.isEnabled('target-worker-filters-v2'));
|
||||
assert.dom('.hds-alert').doesNotExist();
|
||||
});
|
||||
|
||||
test('visiting a tcp target does not show the worker_filter deprecation message when "target-worker-filters-v2" is disabled', async function (assert) {
|
||||
featuresService.disable('target-worker-filters-v2');
|
||||
assert.expect(1);
|
||||
assert.expect(2);
|
||||
await visit(urls.tcpTarget);
|
||||
|
||||
assert.false(featuresService.isEnabled('target-worker-filters-v2'));
|
||||
assert.dom('.hds-alert').doesNotExist();
|
||||
});
|
||||
|
||||
test('cannot navigate to a ssh target form without proper authorization', async function (assert) {
|
||||
test('cannot navigate to an ssh target form without proper authorization', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('ssh-target');
|
||||
await visit(urls.projectScope);
|
||||
instances.sshTarget.authorized_actions =
|
||||
instances.sshTarget.authorized_actions.filter((item) => item !== 'read');
|
||||
@@ -163,6 +164,7 @@ module('Acceptance | targets | read', function (hooks) {
|
||||
|
||||
test('cannot navigate to a tcp target form without proper authorization', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('ssh-target');
|
||||
await visit(urls.projectScope);
|
||||
instances.tcpTarget.authorized_actions =
|
||||
instances.tcpTarget.authorized_actions.filter((item) => item !== 'read');
|
||||
|
||||
@@ -39,7 +39,6 @@ module('Acceptance | targets | update', function (hooks) {
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('target-worker-filters-v2');
|
||||
// Generate resources
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
@@ -96,10 +95,9 @@ module('Acceptance | targets | update', function (hooks) {
|
||||
});
|
||||
|
||||
test('updating a target does not show the worker_filter deprecation message when "target-worker-filters-v2" is disabled', async function (assert) {
|
||||
featuresService.disable('target-worker-filters-v2');
|
||||
assert.expect(1);
|
||||
assert.expect(2);
|
||||
await visit(urls.target);
|
||||
|
||||
assert.false(featuresService.isEnabled('target-worker-filters-v2'));
|
||||
assert.dom('.hds-alert').doesNotExist();
|
||||
});
|
||||
|
||||
@@ -366,6 +364,8 @@ module('Acceptance | targets | update', function (hooks) {
|
||||
|
||||
test('saving address with existing host sources brings up confirmation modal and removes host sources', async function (assert) {
|
||||
assert.expect(4);
|
||||
featuresService.enable('ssh-target');
|
||||
featuresService.enable('target-network-address');
|
||||
const confirmService = this.owner.lookup('service:confirm');
|
||||
confirmService.enabled = true;
|
||||
this.server.createList(
|
||||
@@ -410,6 +410,8 @@ module('Acceptance | targets | update', function (hooks) {
|
||||
|
||||
test('saving address with existing host sources brings up confirmation modal and can cancel', async function (assert) {
|
||||
assert.expect(4);
|
||||
featuresService.enable('ssh-target');
|
||||
featuresService.enable('target-network-address');
|
||||
const confirmService = this.owner.lookup('service:confirm');
|
||||
confirmService.enabled = true;
|
||||
this.server.createList(
|
||||
|
||||
@@ -54,21 +54,21 @@ module('Acceptance | workers | create', function (hooks) {
|
||||
});
|
||||
|
||||
test('initial upstreams input field is visible for `oss` binary', async function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('byow-pki-hcp-cluster-id');
|
||||
await visit(newWorkerURL);
|
||||
const labels = findAll('label.rose-form-label');
|
||||
assert.false(featuresService.isEnabled('byow-pki-hcp-cluster-id'));
|
||||
assert.dom(labels[0]).doesNotIncludeText('Boundary Cluster ID');
|
||||
assert.dom(labels[2]).hasText('Initial Upstreams');
|
||||
});
|
||||
|
||||
test('download and install step shows correct oss instructions', async function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('byow-pki-hcp-cluster-id');
|
||||
await visit(newWorkerURL);
|
||||
const createSection = findAll('.worker-create-section');
|
||||
assert.false(featuresService.isEnabled('byow-pki-hcp-cluster-id'));
|
||||
assert.dom(createSection[1]).includesText('curl -fsSL');
|
||||
assert.dom(createSection[1]).doesNotIncludeText('wget -q');
|
||||
});
|
||||
|
||||
@@ -18,6 +18,8 @@ module('Acceptance | workers | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
@@ -31,14 +33,15 @@ module('Acceptance | workers | list', function (hooks) {
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
|
||||
urls.globalScope = `/scopes/global/scopes`;
|
||||
urls.workers = `/scopes/global/workers`;
|
||||
authenticateSession({});
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('Users can navigate to workers with proper authorization', async function (assert) {
|
||||
assert.expect(2);
|
||||
featuresService.enable('byow');
|
||||
await visit(urls.globalScope);
|
||||
assert.ok(
|
||||
instances.scopes.global.authorized_collection_actions.workers.includes(
|
||||
@@ -50,6 +53,7 @@ module('Acceptance | workers | list', function (hooks) {
|
||||
|
||||
test('Users cannot navigate to workers without list or create permissions', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('byow');
|
||||
instances.scopes.global.authorized_collection_actions.workers = [];
|
||||
|
||||
await visit(urls.globalScope);
|
||||
@@ -58,6 +62,7 @@ module('Acceptance | workers | list', function (hooks) {
|
||||
|
||||
test('Users can navigate to workers with only create permission', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('byow');
|
||||
instances.scopes.global.authorized_collection_actions.workers = [
|
||||
'create:worker-led',
|
||||
];
|
||||
@@ -68,6 +73,7 @@ module('Acceptance | workers | list', function (hooks) {
|
||||
|
||||
test('Users can navigate to workers with only list permission', async function (assert) {
|
||||
assert.expect(1);
|
||||
featuresService.enable('byow');
|
||||
instances.scopes.global.authorized_collection_actions.workers = ['list'];
|
||||
|
||||
await visit(urls.globalScope);
|
||||
|
||||
@@ -16,13 +16,11 @@ module(
|
||||
setupIntl(hooks);
|
||||
|
||||
let featuresService;
|
||||
const targetWorkerFilterIngress = 'target-worker-filters-v2-ingress';
|
||||
const targetWorkerFilterHCP = 'target-worker-filters-v2-hcp';
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
featuresService.enable(targetWorkerFilterHCP);
|
||||
featuresService.disable(targetWorkerFilterIngress);
|
||||
});
|
||||
|
||||
test('it renders the correct diagram when egress and ingress filter is false', async function (assert) {
|
||||
|
||||
@@ -17,12 +17,10 @@ module(
|
||||
|
||||
let featuresService;
|
||||
const targetWorkerFilterIngress = 'target-worker-filters-v2-ingress';
|
||||
const targetWorkerFilterHCP = 'target-worker-filters-v2-hcp';
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
featuresService.enable(targetWorkerFilterIngress);
|
||||
featuresService.disable(targetWorkerFilterHCP);
|
||||
});
|
||||
|
||||
test('it renders the correct diagram when egress and ingress filter is false', async function (assert) {
|
||||
|
||||
@@ -19,31 +19,32 @@ module('Integration | Component | worker-diagram/index', function (hooks) {
|
||||
|
||||
test('it renders a single filter diagram', async function (assert) {
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable(targetWorkerFilterIngress);
|
||||
featuresService.disable(targetWorkerFilterHCP);
|
||||
assert.expect(1);
|
||||
assert.expect(3);
|
||||
await render(hbs`<WorkerDiagram />`);
|
||||
|
||||
assert.false(featuresService.isEnabled(targetWorkerFilterIngress));
|
||||
assert.false(featuresService.isEnabled(targetWorkerFilterHCP));
|
||||
assert.dom('[data-test-single-filter-egress-off]').isVisible();
|
||||
});
|
||||
|
||||
test('it renders a dual filter diagram when `target-worker-filters-v2-ingress` is enabled', async function (assert) {
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
featuresService.enable(targetWorkerFilterIngress);
|
||||
featuresService.disable(targetWorkerFilterHCP);
|
||||
assert.expect(1);
|
||||
assert.expect(3);
|
||||
assert.true(featuresService.isEnabled(targetWorkerFilterIngress));
|
||||
assert.false(featuresService.isEnabled(targetWorkerFilterHCP));
|
||||
await render(hbs`<WorkerDiagram />`);
|
||||
|
||||
assert.dom('[data-test-dual-filter-egress-off-ingress-off]').isVisible();
|
||||
});
|
||||
|
||||
test('it renders a HCP dual filter diagram when `target-worker-filters-v2-hcp` is enabled', async function (assert) {
|
||||
test('it renders an HCP dual filter diagram when `target-worker-filters-v2-hcp` is enabled', async function (assert) {
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
featuresService.enable(targetWorkerFilterIngress);
|
||||
featuresService.enable(targetWorkerFilterHCP);
|
||||
assert.expect(1);
|
||||
assert.expect(3);
|
||||
await render(hbs`<WorkerDiagram />`);
|
||||
|
||||
assert.true(featuresService.isEnabled(targetWorkerFilterIngress));
|
||||
assert.true(featuresService.isEnabled(targetWorkerFilterHCP));
|
||||
assert
|
||||
.dom('[data-test-dual-filter-hcp-egress-off-ingress-off]')
|
||||
.isVisible();
|
||||
|
||||
@@ -17,11 +17,11 @@ module('Unit | Abilities | credential-library', function (hooks) {
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
features = this.owner.lookup('service:features');
|
||||
features.enable('ssh-target');
|
||||
});
|
||||
|
||||
test('can read credential library type when authorized and feature is enabled', function (assert) {
|
||||
assert.expect(2);
|
||||
features.enable('ssh-target');
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
@@ -35,6 +35,7 @@ module('Unit | Abilities | credential-library', function (hooks) {
|
||||
|
||||
test('cannot read credential library type when unauthorized and feature is enabled', function (assert) {
|
||||
assert.expect(2);
|
||||
features.enable('ssh-target');
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
@@ -47,30 +48,30 @@ module('Unit | Abilities | credential-library', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot read credential library type when unauthorized and feature is disabled', function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('ssh-target');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
authorized_actions: [],
|
||||
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
});
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
credentialLibrary.type = TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC;
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
});
|
||||
|
||||
test('can read vault-generic but not vault-ssh-certificate when authorized and feature is disabled', function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('ssh-target');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
authorized_actions: ['read'],
|
||||
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
});
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
credentialLibrary.type = TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC;
|
||||
assert.true(canService.can('read credential-library', credentialLibrary));
|
||||
|
||||
@@ -9,16 +9,16 @@ import { setupTest } from 'ember-qunit';
|
||||
module('Unit | Abilities | credential', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let features;
|
||||
let featuresService;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
// Enable json-credentials feature by default
|
||||
features = this.owner.lookup('service:features');
|
||||
features.enable('json-credentials');
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('can read credentials, including JSON credentials, when authorized and json-credentials feature is enabled', function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('json-credentials');
|
||||
const service = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credential = store.createRecord('credential', {
|
||||
@@ -34,6 +34,7 @@ module('Unit | Abilities | credential', function (hooks) {
|
||||
|
||||
test('cannot read credentials, including JSON credentials, when unauthorized and json-credentials feature is enabled', function (assert) {
|
||||
assert.expect(3);
|
||||
featuresService.enable('json-credentials');
|
||||
const service = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credential = store.createRecord('credential', {
|
||||
@@ -48,15 +49,14 @@ module('Unit | Abilities | credential', function (hooks) {
|
||||
});
|
||||
|
||||
test('cannot read credentials, including JSON credentials, when unauthorized and json-credentials feature is disabled', function (assert) {
|
||||
assert.expect(3);
|
||||
assert.expect(4);
|
||||
const service = this.owner.lookup('service:can');
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
featuresService.disable('json-credentials');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credential = store.createRecord('credential', {
|
||||
authorized_actions: [],
|
||||
type: 'json',
|
||||
});
|
||||
assert.false(featuresService.isEnabled('json-credentials'));
|
||||
assert.false(service.can('read credential', credential));
|
||||
credential.type = 'username_password';
|
||||
assert.false(service.can('read credential', credential));
|
||||
@@ -65,14 +65,14 @@ module('Unit | Abilities | credential', function (hooks) {
|
||||
});
|
||||
|
||||
test('can read credentials, excepting JSON credentials, when authorized and json-credentials feature is disabled', function (assert) {
|
||||
assert.expect(3);
|
||||
features.disable('json-credentials');
|
||||
assert.expect(4);
|
||||
const service = this.owner.lookup('service:can');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credential = store.createRecord('credential', {
|
||||
authorized_actions: ['read'],
|
||||
type: 'json',
|
||||
});
|
||||
assert.false(featuresService.isEnabled('json-credentials'));
|
||||
assert.false(service.can('read credential', credential));
|
||||
credential.type = 'username_password';
|
||||
assert.true(service.can('read credential', credential));
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Application from '@ember/application';
|
||||
|
||||
import config from 'admin/config/environment';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'admin/tests/helpers';
|
||||
|
||||
|
||||
Reference in new issue
Block a user