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

test(admin/e2e): Update DHC test to catch host issue #1648

Merged
merged 2 commits into from
Feb 28, 2023
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
6 changes: 3 additions & 3 deletions ui/admin/tests/e2e/tests/credential-store-static.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ test('Static Credential Store (User & Key Pair)', async ({ page }) => {
if (process.env.E2E_SSH_USER != retrievedUser) {
throw new Error(
'Stored User does not match. EXPECTED: ' +
process.env.E2E_SSH_USER +
', ACTUAL: ' +
retrievedUser
process.env.E2E_SSH_USER +
', ACTUAL: ' +
retrievedUser
);
}
if (keyData != retrievedKey) {
Expand Down
24 changes: 12 additions & 12 deletions ui/admin/tests/e2e/tests/credential-store-vault.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ test('Vault Credential Store (User & Key Pair)', async ({ page }) => {
execSync(`vault secrets enable -path=${secretsPath} kv-v2`);
execSync(
`vault kv put -mount ${secretsPath} ${secretName} ` +
` username=${process.env.E2E_SSH_USER}` +
` private_key=@${process.env.E2E_SSH_KEY_PATH}`
` username=${process.env.E2E_SSH_USER}` +
` private_key=@${process.env.E2E_SSH_KEY_PATH}`
);
execSync(
`vault policy write ${secretPolicyName} ./tests/e2e/tests/fixtures/kv-policy.hcl`
);
const vaultToken = JSON.parse(
execSync(
`vault token create` +
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`
)
);
const clientToken = vaultToken.auth.client_token;
Expand Down Expand Up @@ -170,9 +170,9 @@ test('Vault Credential Store (User & Key Pair)', async ({ page }) => {
if (process.env.E2E_SSH_USER != retrievedUser) {
throw new Error(
'Stored User does not match. EXPECTED: ' +
process.env.E2E_SSH_USER +
', ACTUAL: ' +
retrievedUser
process.env.E2E_SSH_USER +
', ACTUAL: ' +
retrievedUser
);
}
if (keyData != retrievedKey) {
Expand Down
40 changes: 34 additions & 6 deletions ui/admin/tests/e2e/tests/dynamic-host-catalog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ test.describe('AWS', async () => {
.getByRole('link', { name: hostCatalogName })
).toBeVisible();

// Create first host set
const hostSetName1 = 'Host Set ' + nanoid();
await page.getByRole('link', { name: 'Host Sets' }).click();
await page.getByRole('link', { name: 'New', exact: true }).click();
Expand Down Expand Up @@ -94,6 +95,7 @@ test.describe('AWS', async () => {
.getByRole('link', { name: 'Hosts' })
).toBeVisible();

// Check number of hosts in host set
let i = 0;
let rowCount = 0;
let hostsAreVisible = false;
Expand Down Expand Up @@ -121,12 +123,37 @@ test.describe('AWS', async () => {
if (!hostsAreVisible) {
throw new Error(
'Hosts are not visible. EXPECTED: ' +
expectedHosts.length +
', ACTUAL: ' +
rowCount
expectedHosts.length +
', ACTUAL: ' +
rowCount
);
}

// Navigate to each host in the host set
for (let i = 0; i < expectedHosts.length; i++) {
const host = await page
.getByRole('table')
.getByRole('rowgroup')
.nth(1)
.getByRole('row')
.nth(i)
.getByRole('link');

let hostName = await host.innerText();
await host.click();
await expect(
page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByRole('link', { name: hostName })
).toBeVisible();

await page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByRole('link', { name: hostSetName1 })
.click();
}

// Create second host set
const hostSetName2 = 'Host Set ' + nanoid();
await page
.getByRole('navigation', { name: 'breadcrumbs' })
Expand Down Expand Up @@ -155,6 +182,7 @@ test.describe('AWS', async () => {
.getByRole('link', { name: hostSetName2 })
).toBeVisible();

// Check number of hosts in host set
await page.getByRole('link', { name: 'Hosts' }).click();
i = 0;
rowCount = 0;
Expand Down Expand Up @@ -183,9 +211,9 @@ test.describe('AWS', async () => {
if (!hostsAreVisible) {
throw new Error(
'Hosts are not visible. EXPECTED: ' +
expectedHosts.length +
', ACTUAL: ' +
rowCount
expectedHosts.length +
', ACTUAL: ' +
rowCount
);
}
});
Expand Down