chore(e2e): Update e2e tests to work for boundary-ui-enterprise (#3197)
* test: 💍 Update usage of Vault addresses * chore: 🤖 Update admin ui e2e tests for boundary-ui-enterprise * chore: 🤖 Update desktop e2e tests for boundary-ui-enterprise
This commit is contained in:
1 parent
52e36e6463
commit
6c3a57b599
8 files changed
+126
-49
No files matched your search
@@ -26,6 +26,10 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
name: test
|
||||
# don't need to run e2e tests on ce -> ent merges since tests were already
|
||||
# run in the ce branch, and there are currently no code diffferences between
|
||||
# the two repos
|
||||
if: github.actor != 'hc-github-team-secure-boundary'
|
||||
runs-on: ${{ fromJSON(vars.RUNNER_UBUNTU_22) }}
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -76,8 +80,12 @@ jobs:
|
||||
|
||||
- name: Install Vault CLI
|
||||
run: |
|
||||
wget https://releases.hashicorp.com/vault/1.12.2/vault_1.12.2_linux_amd64.zip -O /tmp/vault.zip
|
||||
unzip /tmp/vault.zip -d /usr/local/bin
|
||||
wget https://releases.hashicorp.com/vault/1.17.6/vault_1.17.6_linux_amd64.zip -O /tmp/vault.zip
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
unzip -o -q /tmp/vault.zip -d /usr/local/bin
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
unzip -o -q /tmp/vault.zip -d "$HOME/bin"
|
||||
fi
|
||||
|
||||
- name: GPG setup
|
||||
run: |
|
||||
@@ -126,6 +134,8 @@ jobs:
|
||||
echo "trusted-key $KEY_ID" >> ~/.gnupg/gpg.conf
|
||||
|
||||
# Initialize the password store
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y pass
|
||||
pass init $KEY_ID &>/dev/null
|
||||
|
||||
- name: Checkout ${{ matrix.folder_name }} repo
|
||||
@@ -138,14 +148,12 @@ jobs:
|
||||
|
||||
- name: GH fix for localhost resolution
|
||||
run: |
|
||||
cat /etc/hosts && echo "-----------"
|
||||
sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6 -localhost ip6-loopback/g' /etc/hosts
|
||||
cat /etc/hosts
|
||||
ssh -V
|
||||
|
||||
echo "127.0.0.1 localhost boundary" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 localhost worker" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 localhost vault" | sudo tee -a /etc/hosts
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
cat /etc/hosts && echo "-----------"
|
||||
sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6 -localhost ip6-loopback/g' /etc/hosts
|
||||
cat /etc/hosts
|
||||
ssh -V
|
||||
fi
|
||||
|
||||
- name: Set git config
|
||||
run: |
|
||||
@@ -155,15 +163,40 @@ jobs:
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
cd e2e-tests
|
||||
pnpm playwright install --with-deps
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
pnpm playwright install --with-deps
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
# playwright dependencies can't be installed on a self-hosted runner
|
||||
# due to permission issues
|
||||
pnpm playwright install
|
||||
fi
|
||||
|
||||
- name: Determine Go version
|
||||
id: get-go-version
|
||||
run: |
|
||||
echo "Building with Go $(cat ./support/src/${{matrix.folder_name}}/.go-version)"
|
||||
echo "go-version=$(cat ./support/src/${{matrix.folder_name}}/.go-version)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
||||
cache: false
|
||||
|
||||
- name: Set up test infra
|
||||
id: infra
|
||||
run: |
|
||||
ssh-keygen -N '' -t ed25519 -f ~/.ssh/github_enos
|
||||
mkdir -p ./enos/terraform-plugin-cache
|
||||
echo ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} > ./support/src/${{matrix.folder_name}}/internal/ui/VERSION
|
||||
export ENOS_VAR_ui_build_override="oss" && \
|
||||
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
echo ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} > ./support/src/${{matrix.folder_name}}/internal/ui/VERSION
|
||||
export ENOS_VAR_ui_build_override="oss"
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
echo ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} > ./support/src/${{matrix.folder_name}}/internal/ui/VERSION_ent
|
||||
export ENOS_VAR_ui_build_override="enterprise"
|
||||
fi
|
||||
|
||||
export ENOS_VAR_boundary_edition=${{ matrix.boundary_edition_short }} && \
|
||||
export ENOS_VAR_enos_user=$GITHUB_ACTOR && \
|
||||
export ENOS_VAR_aws_ssh_private_key_path=~/.ssh/github_enos && \
|
||||
@@ -172,14 +205,25 @@ jobs:
|
||||
|
||||
- name: Move boundary binary
|
||||
run: |
|
||||
mv ./support/src/${{matrix.folder_name}}/bin/boundary /usr/local/bin/
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
mv ./support/src/${{matrix.folder_name}}/bin/boundary /usr/local/bin/
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
mv ./support/src/${{matrix.folder_name}}/bin/boundary $HOME/bin
|
||||
fi
|
||||
|
||||
boundary version
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
source <(bash ./support/src/${{matrix.folder_name}}/enos/scripts/test_e2e_env.sh)
|
||||
cd e2e-tests
|
||||
pnpm run ${{ matrix.test_command }} --reporter=html
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
pnpm run ${{ matrix.test_command }} --reporter=html
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
# only run tests on chromium because playwright dependencies can't
|
||||
# be installed to support other browsers
|
||||
pnpm run ${{ matrix.test_command }} --project=chromium --reporter=html
|
||||
fi
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: ${{ failure() }}
|
||||
|
||||
@@ -26,6 +26,10 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
name: test
|
||||
# don't need to run e2e tests on ce -> ent merges since tests were already
|
||||
# run in the ce branch, and there are currently no code diffferences between
|
||||
# the two repos
|
||||
if: github.actor != 'hc-github-team-secure-boundary'
|
||||
runs-on: ${{ fromJSON(vars.RUNNER_UBUNTU_22) }}
|
||||
env:
|
||||
ENOS_VAR_boundary_edition: "ent"
|
||||
@@ -59,9 +63,13 @@ jobs:
|
||||
|
||||
- name: Install Vault CLI
|
||||
run: |
|
||||
wget https://releases.hashicorp.com/vault/1.12.2/vault_1.12.2_linux_amd64.zip -O /tmp/vault.zip
|
||||
unzip /tmp/vault.zip -d /usr/local/bin
|
||||
|
||||
wget https://releases.hashicorp.com/vault/1.17.6/vault_1.17.6_linux_amd64.zip -O /tmp/vault.zip
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
unzip -o -q /tmp/vault.zip -d /usr/local/bin
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
unzip -o -q /tmp/vault.zip -d "$HOME/bin"
|
||||
fi
|
||||
|
||||
# TODO: We should consider modifying to also build CE binary. For now
|
||||
# building ENT binary using most recent UI commit is sufficient.
|
||||
- name: Checkout boundary-enterprise
|
||||
@@ -87,19 +95,29 @@ jobs:
|
||||
|
||||
- name: GH fix for localhost resolution
|
||||
run: |
|
||||
cat /etc/hosts && echo "-----------"
|
||||
sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6 -localhost ip6-loopback/g' /etc/hosts
|
||||
cat /etc/hosts
|
||||
ssh -V
|
||||
|
||||
echo "127.0.0.1 localhost boundary" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 localhost worker" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 localhost vault" | sudo tee -a /etc/hosts
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
cat /etc/hosts && echo "-----------"
|
||||
sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6 -localhost ip6-loopback/g' /etc/hosts
|
||||
cat /etc/hosts
|
||||
ssh -V
|
||||
fi
|
||||
|
||||
- name: Set git config
|
||||
run: |
|
||||
git config --global url."https://oauth2:${{ secrets.ELEVATED_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com"
|
||||
|
||||
- name: Determine Go version
|
||||
id: get-go-version
|
||||
run: |
|
||||
echo "Building with Go $(cat ./support/src/boundary-enterprise/.go-version)"
|
||||
echo "go-version=$(cat ./support/src/boundary-enterprise/.go-version)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
||||
cache: false
|
||||
|
||||
- name: Set up test infra
|
||||
id: infra
|
||||
run: |
|
||||
@@ -114,22 +132,36 @@ jobs:
|
||||
|
||||
- name: Move boundary binary
|
||||
run: |
|
||||
mv ./support/src/boundary-enterprise/bin/boundary /usr/local/bin/
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
mv ./support/src/boundary-enterprise/bin/boundary /usr/local/bin/
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
mv ./support/src/boundary-enterprise/bin/boundary $HOME/bin
|
||||
fi
|
||||
boundary version
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
cd e2e-tests
|
||||
pnpm playwright install --with-deps
|
||||
if [[ "${{ github.repository }}" == "hashicorp/boundary-ui" ]]; then
|
||||
pnpm playwright install --with-deps
|
||||
elif [[ "${{ github.repository }}" == "hashicorp/boundary-ui-enterprise" ]]; then
|
||||
# playwright dependencies can't be installed on a self-hosted runner
|
||||
# due to permission issues
|
||||
pnpm playwright install
|
||||
|
||||
sudo apt update -qq
|
||||
sudo apt install xvfb -y
|
||||
fi
|
||||
|
||||
# Runner is headless so we need to enable a display to run the client
|
||||
- name: Run Tests
|
||||
run: |
|
||||
source <(bash ./support/src/boundary-enterprise/enos/scripts/test_e2e_env.sh)
|
||||
cd e2e-tests
|
||||
|
||||
export DISPLAY=:99
|
||||
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
|
||||
Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
|
||||
pnpm run desktop
|
||||
|
||||
- name: Upload Playwright report
|
||||
|
||||
@@ -36,7 +36,7 @@ test(
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
adminPassword,
|
||||
vaultAddr,
|
||||
vaultAddrUnified,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
let orgName;
|
||||
@@ -47,7 +47,7 @@ test(
|
||||
const email = 'vault@hashicorp.com';
|
||||
const { issuer, clientId, clientSecret, authPolicyName } =
|
||||
await vaultCli.setupVaultOidc(
|
||||
vaultAddr,
|
||||
vaultAddrUnified,
|
||||
userName,
|
||||
password,
|
||||
email,
|
||||
|
||||
@@ -50,7 +50,7 @@ test(
|
||||
sshKeyPath,
|
||||
targetAddress,
|
||||
targetPort,
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
}) => {
|
||||
let orgId;
|
||||
try {
|
||||
@@ -60,8 +60,8 @@ test(
|
||||
execSync(`vault secrets enable -path=${secretsPath} kv-v2`);
|
||||
execSync(
|
||||
`vault kv put -mount ${secretsPath} ${secretName} ` +
|
||||
` username=${sshUser}` +
|
||||
` private_key=@${sshKeyPath}`,
|
||||
` username=${sshUser}` +
|
||||
` private_key=@${sshKeyPath}`,
|
||||
);
|
||||
execSync(
|
||||
`vault policy write ${secretPolicyName} ./admin/tests/fixtures/kv-policy.hcl`,
|
||||
@@ -69,13 +69,13 @@ test(
|
||||
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;
|
||||
@@ -91,7 +91,7 @@ test(
|
||||
});
|
||||
const credentialStoresPage = new CredentialStoresPage(page);
|
||||
await credentialStoresPage.createVaultCredentialStore(
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
clientToken,
|
||||
);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ test(
|
||||
sshCaKeyPublic,
|
||||
targetAddress,
|
||||
targetPort,
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
let orgId;
|
||||
@@ -108,7 +108,7 @@ test(
|
||||
// Create credentials
|
||||
const credentialStoresPage = new CredentialStoresPage(page);
|
||||
await credentialStoresPage.createVaultCredentialStore(
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
clientToken,
|
||||
);
|
||||
const credentialLibraryName =
|
||||
|
||||
@@ -47,7 +47,7 @@ test(
|
||||
sshKeyPath,
|
||||
targetAddress,
|
||||
targetPort,
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
}) => {
|
||||
let orgId;
|
||||
let connect;
|
||||
@@ -98,7 +98,7 @@ test(
|
||||
// Create credentials
|
||||
const credentialStoresPage = new CredentialStoresPage(page);
|
||||
await credentialStoresPage.createVaultCredentialStore(
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
clientToken,
|
||||
);
|
||||
const credentialLibraryName =
|
||||
|
||||
@@ -41,7 +41,7 @@ test.beforeEach(
|
||||
targetPort,
|
||||
sshUser,
|
||||
sshKeyPath,
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
}) => {
|
||||
org = await boundaryHttp.createOrg(request);
|
||||
const project = await boundaryHttp.createProject(request, org.id);
|
||||
@@ -138,7 +138,7 @@ test.beforeEach(
|
||||
const vaultCredentialStore = await boundaryHttp.createVaultCredentialStore(
|
||||
request,
|
||||
project.id,
|
||||
vaultAddr,
|
||||
vaultAddrPrivate,
|
||||
clientToken,
|
||||
);
|
||||
vaultGenericCredentialLibrary =
|
||||
|
||||
@@ -92,6 +92,7 @@ export const base = baseTest.extend({
|
||||
targetPort: process.env.E2E_TARGET_PORT,
|
||||
vaultAddr: process.env.E2E_VAULT_ADDR_PUBLIC,
|
||||
vaultAddrPrivate: process.env.E2E_VAULT_ADDR_PRIVATE,
|
||||
vaultAddrUnified: process.env.E2E_VAULT_ADDR_UNIFIED,
|
||||
workerTagEgress: process.env.E2E_WORKER_TAG_EGRESS,
|
||||
request: async ({ playwright }, use) => {
|
||||
const request = await playwright.request.newContext({
|
||||
|
||||
Reference in new issue
Block a user