test(e2e): Refactor imports for boundary cli helper methods (#2632)

* test(e2e): Update imports to match boundary-http conventions

* test(e2e): Remove cli from method name
This commit is contained in:
Michael Li authored and GitHub committed 2024-12-17 10:17:32 -05:00
1 parent daed714b98
commit af8655ec45
37 files changed
+394 -454

No files matched your search

+30 -47
View File
@@ -6,29 +6,8 @@
import { test, authenticatedState } from '../../global-setup.js';
import { execSync } from 'node:child_process';
import {
authenticateBoundaryCli,
checkBoundaryCli,
createOrgCli,
createProjectCli,
createControllerLedWorkerCli,
createPasswordAuthMethodCli,
makeAuthMethodPrimaryCli,
createPasswordAccountCli,
createRoleCli,
createGroupCli,
createUserCli,
createStaticHostCatalogCli,
createDynamicAwsHostCatalogCli,
createStaticHostCli,
createHostSetCli,
createStaticCredentialStoreCli,
createTcpTarget,
createVaultCredentialStoreCli,
createUsernamePasswordCredentialCli,
deleteScopeCli,
} from '../../helpers/boundary-cli.js';
import { checkVaultCli, getVaultToken } from '../../helpers/vault-cli.js';
import * as boundaryCli from '../../helpers/boundary-cli';
import * as vaultCli from '../../helpers/vault-cli';
import { AuthMethodsPage } from '../pages/auth-methods.js';
import { BaseResourcePage } from '../pages/base-resource.js';
import { WorkersPage } from '../pages/workers.js';
@@ -44,15 +23,15 @@ test.use({ storageState: authenticatedState });
test.setTimeout(180000);
test.beforeAll(async () => {
await checkBoundaryCli();
await checkVaultCli();
await boundaryCli.checkBoundaryCli();
await vaultCli.checkVaultCli();
});
test.beforeEach(
async ({ baseURL, adminAuthMethodId, adminLoginName, adminPassword }) => {
execSync(`vault policy delete ${secretPolicyName}`);
execSync(`vault policy delete ${boundaryPolicyName}`);
await authenticateBoundaryCli(
await boundaryCli.authenticateBoundary(
baseURL,
adminAuthMethodId,
adminLoginName,
@@ -70,38 +49,42 @@ test('Verify resources can be deleted @ce @aws', async ({
let orgDeleted = false;
try {
// Create boundary resources using CLI
orgId = await createOrgCli();
let projectId = await createProjectCli(orgId);
let workerId = await createControllerLedWorkerCli();
let authMethodId = await createPasswordAuthMethodCli(orgId);
await makeAuthMethodPrimaryCli(orgId, authMethodId);
let passwordAccountId = await createPasswordAccountCli(authMethodId);
let projectScopeRoleId = await createRoleCli(projectId);
let orgScopeRoleId = await createRoleCli(orgId);
let globalScopeRoleId = await createRoleCli('global');
let groupId = await createGroupCli(orgId);
let userId = await createUserCli(orgId);
let staticHostCatalogId = await createStaticHostCatalogCli(projectId);
let dynamicAwsHostCatalogId = await createDynamicAwsHostCatalogCli(
orgId = await boundaryCli.createOrg();
let projectId = await boundaryCli.createProject(orgId);
let workerId = await boundaryCli.createControllerLedWorker();
let authMethodId = await boundaryCli.createPasswordAuthMethod(orgId);
await boundaryCli.makeAuthMethodPrimary(orgId, authMethodId);
let passwordAccountId =
await boundaryCli.createPasswordAccount(authMethodId);
let projectScopeRoleId = await boundaryCli.createRole(projectId);
let orgScopeRoleId = await boundaryCli.createRole(orgId);
let globalScopeRoleId = await boundaryCli.createRole('global');
let groupId = await boundaryCli.createGroup(orgId);
let userId = await boundaryCli.createUser(orgId);
let staticHostCatalogId =
await boundaryCli.createStaticHostCatalog(projectId);
let dynamicAwsHostCatalogId = await boundaryCli.createDynamicAwsHostCatalog(
projectId,
awsRegion,
);
let staticHostId = await createStaticHostCli(staticHostCatalogId);
let staticHostSetId = await createHostSetCli(staticHostCatalogId);
let staticHostId = await boundaryCli.createStaticHost(staticHostCatalogId);
let staticHostSetId = await boundaryCli.createHostSet(staticHostCatalogId);
let staticCredentialStoreId =
await createStaticCredentialStoreCli(projectId);
const vaultToken = await getVaultToken(
await boundaryCli.createStaticCredentialStore(projectId);
const vaultToken = await vaultCli.getVaultToken(
boundaryPolicyName,
secretPolicyName,
);
let vaultCredentialStoreId = await createVaultCredentialStoreCli(
let vaultCredentialStoreId = await boundaryCli.createVaultCredentialStore(
projectId,
vaultAddr,
vaultToken,
);
let usernamePasswordCredentialId =
await createUsernamePasswordCredentialCli(staticCredentialStoreId);
let tcpTargetId = await createTcpTarget(projectId);
await boundaryCli.createUsernamePasswordCredential(
staticCredentialStoreId,
);
let tcpTargetId = await boundaryCli.createTcpTarget(projectId);
const baseResourcePage = new BaseResourcePage(page);
@@ -199,7 +182,7 @@ test('Verify resources can be deleted @ce @aws', async ({
} finally {
// Delete org in case the test failed before deleting the org using UI
if (orgId && orgDeleted === false) {
await deleteScopeCli(orgId);
await boundaryCli.deleteScope(orgId);
}
}
});