Files
threshold-ui/ui/admin/tests/e2e/helpers/boundary-cli.js
T
+1 2d5323b07a Merge main into session recording (#219)
* 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>

* fix: 🐛 Fix missing translation (#1662)

Fix missing translation on the toggle color theme selector

* Resolutions audit: Delete 3 oldest resolutions (#1663)

* Delete bl from resolutions

* Delete tough-cookie from resolutions

* Delete npm from resolutions

* chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#1665)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: 🤖 Update electron-forge/* packages (#1666)

Update electron-forge/* packages

* feat: 🎸 Add support to display external name for dynamic hosts (#1664)

* feat: 🎸 Add support to display external name for dynamic hosts

✅ Closes: ICU-8795

* test(admin/e2e): Add create target with address test (#1667)

* chore: 🤖 update design system package (#1668)

* test(admin/e2e): Define expected private key for vault credential store test (#1671)

* test: 💍 (admin-e2e): Add test to create different credentials (#1670)

* chore: 🤖 add json5 to resolutions per dependabot alerts (#1672)

* chore: 🤖 add json5 to resolutions per dependabot alerts

* fix: 🐛 remove unecessary resolutions

* chore: 🤖 upgrade @storybook/ember-cli-storybook to 0.6.0 (#1669)

* chore: 🤖 update @storybook/ember-cli-storybook to 0.6.0

✅ Closes: ICU-6588

* chore: 🤖 remove css-what from resolutions

* refactor: 💡 update selector for delete storage bucket test

* chore: 🤖 fix yarn.lock

---------

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: Randall Morey <randall@randallmorey.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>
Co-authored-by: Stan Ryzhov <60649800+stasryzhov@users.noreply.github.com>
Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
2023-04-25 16:22:12 -05:00

111 lines
3.2 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
/* eslint-disable no-undef */
const { execSync, exec } = require('child_process');
/**
* Checks that the boundary cli is available
*/
exports.checkBoundaryCli = async () => {
try {
execSync('which boundary');
} catch (e) {
throw new Error('boundary does not exist on the path');
}
};
/**
* Uses the boundary CLI to authenticate to the specified Boundary instance
*/
exports.authenticateBoundaryCli = async () => {
try {
execSync(
'boundary authenticate password' +
' -addr=' +
process.env.BOUNDARY_ADDR +
' -auth-method-id=' +
process.env.E2E_PASSWORD_AUTH_METHOD_ID +
' -login-name=' +
process.env.E2E_PASSWORD_ADMIN_LOGIN_NAME +
' -password=env://E2E_PASSWORD_ADMIN_PASSWORD'
);
} catch (e) {
console.log(`${e.stderr}`);
}
};
/**
* Uses the boundary CLI to connect to the specified target
* @param {string} targetId ID of the target to be connected to
* @returns ChildProcess representing the result of the command execution
*/
exports.connectToTarget = async (targetId) => {
let connect;
try {
connect = exec(
'boundary connect' +
' -target-id=' +
targetId +
' -exec /usr/bin/ssh --' +
' -l ' +
process.env.E2E_SSH_USER +
' -i ' +
process.env.E2E_SSH_KEY_PATH +
' -o UserKnownHostsFile=/dev/null' +
' -o StrictHostKeyChecking=no' +
' -o IdentitiesOnly=yes' + // forces the use of the provided key
' -p {{boundary.port}}' +
' {{boundary.ip}}'
);
} catch (e) {
console.log(`${e.stderr}`);
}
return connect;
};
/**
* Uses the boundary CLI to delete the specified organization
* @param {string} orgId ID of the organization to be deleted
*/
exports.deleteOrg = async (orgId) => {
try {
exec('boundary scopes delete -id=' + orgId);
} catch (e) {
console.log(`${e.stderr}`);
}
};
/**
* Uses the boundary CLI to get a session created for the specified target
* @param {string} orgName Name of the organization with the specified project
* @param {string} projectName Name of project with the specified target
* @param {string} targetName Name of the target that the anticipated session is created for
* @returns An object representing an active session created for the specified target
*/
exports.getSessionCli = async (orgName, projectName, targetName) => {
let session;
try {
const orgs = JSON.parse(execSync('boundary scopes list -format json'));
const org = orgs.items.filter((obj) => obj.name == orgName)[0];
const projects = JSON.parse(
execSync(`boundary scopes list -format json -scope-id ${org.id}`)
);
const project = projects.items.filter((obj) => obj.name == projectName)[0];
const targets = JSON.parse(
execSync(`boundary targets list -format json -scope-id ${project.id}`)
);
const target = targets.items.filter((obj) => obj.name == targetName)[0];
session = JSON.parse(
execSync(
`boundary targets authorize-session -id ${target.id} -format json`
)
);
} catch (e) {
console.log(`${e.stderr}`);
}
return session;
};