chore(e2e): Remove need to modify /etc/hosts (#6486)
* ce: chore(e2e): Remove need for /etc/hosts modifications (cherry picked from commit df230ea09af3d006db006487ebd644a0d3dd76f2) * ce: test(e2e): Fix test that was failing (cherry picked from commit 310ebf2a9b6c7427c1ff6c1c9e9045c1deb13a40)
This commit is contained in:
1 parent
b07883e8aa
commit
67f9815c64
38 files changed
+138
-308
No files matched your search
@@ -110,6 +110,11 @@ variable "vault_addr_private" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
variable "vault_addr_unified" {
|
||||
description = "Unified address to a vault instance that can be used for both internal and external communication"
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
variable "vault_root_token" {
|
||||
description = "Root token for vault instance"
|
||||
type = string
|
||||
@@ -336,6 +341,7 @@ resource "enos_local_exec" "run_e2e_test" {
|
||||
VAULT_TOKEN = var.vault_root_token
|
||||
E2E_VAULT_ADDR_PUBLIC = var.vault_addr_public
|
||||
E2E_VAULT_ADDR_PRIVATE = var.vault_addr_private
|
||||
E2E_VAULT_ADDR_UNIFIED = var.vault_addr_unified
|
||||
E2E_BUCKET_NAME = var.bucket_name
|
||||
E2E_BUCKET_ENDPOINT_URL = var.bucket_endpoint_url
|
||||
E2E_BUCKET_USER_ID = var.bucket_user_id
|
||||
@@ -375,6 +381,6 @@ resource "enos_local_exec" "run_e2e_test" {
|
||||
}
|
||||
|
||||
inline = var.debug_no_run ? [""] : [
|
||||
"bash ./${path.module}/test_runner.sh"
|
||||
"set -o pipefail; PATH=\"${var.local_boundary_dir}:$PATH\" go test -v ${var.test_package} -count=1 -timeout ${var.test_timeout} | tee ${path.module}/../../test-e2e-${local.package_name}.log"
|
||||
]
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright IBM Corp. 2020, 2025
|
||||
# SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
# This script is used for setting up and executing boundary e2e tests. It sets
|
||||
# up `pass` as a password store (linux) so that boundary can use it to store
|
||||
# auth tokens and installs the latest vault cli before executing the desired tests.
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
# Install dependencies
|
||||
apt update
|
||||
# unzip is used to unzip boundary.zip
|
||||
# pass is used to store the auth token from `boundary authenticate``
|
||||
# lsb-release is used for adding the hashicorp apt source
|
||||
# postgresql-client is used for postgres tests
|
||||
# default-mysql-client is used for mysql tests
|
||||
# wget is used for downloading external dependencies and repository keys
|
||||
# apt-transport-https enables HTTPS transport for APT repositories
|
||||
# curl and ca-certificates are required for some repository setups (e.g., MongoDB).
|
||||
apt install unzip pass lsb-release postgresql-client default-mysql-client wget apt-transport-https curl ca-certificates -y
|
||||
|
||||
# Function to install Cassandra
|
||||
install_cassandra() {
|
||||
# Add Cassandra repository key
|
||||
wget -O cassandra.keys https://www.apache.org/dist/cassandra/KEYS
|
||||
|
||||
# Convert key to gpg format
|
||||
gpg --no-default-keyring --keyring ./temp-keyring.gpg --import cassandra.keys
|
||||
gpg --no-default-keyring --keyring ./temp-keyring.gpg --export --output cassandra.gpg
|
||||
rm ./temp-keyring.gpg cassandra.keys
|
||||
mv cassandra.gpg /etc/apt/keyrings/cassandra.gpg
|
||||
|
||||
# Add Cassandra repository
|
||||
echo "deb [signed-by=/etc/apt/keyrings/cassandra.gpg] https://debian.cassandra.apache.org 41x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list
|
||||
|
||||
# Update package list and install Cassandra
|
||||
apt update
|
||||
apt install cassandra -y
|
||||
}
|
||||
|
||||
# Install Cassandra
|
||||
install_cassandra
|
||||
|
||||
# Install Redis
|
||||
apt install redis-server -y
|
||||
|
||||
# Create a GPG key
|
||||
export KEY_PW=boundary
|
||||
gpg --generate-key --batch <<eoGpgConf
|
||||
%echo Started!
|
||||
Key-Type: RSA
|
||||
Key-Length: default
|
||||
Subkey-Type: RSA
|
||||
Name-Real: boundary
|
||||
Name-Comment: default
|
||||
Name-Email: default
|
||||
Expire-Date: 0
|
||||
Passphrase: $KEY_PW
|
||||
%commit
|
||||
%echo Done.
|
||||
eoGpgConf
|
||||
|
||||
# Enable gpg-preset-passphrase so that key passwords can be saved
|
||||
echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf
|
||||
gpg-connect-agent reloadagent /bye &>/dev/null
|
||||
|
||||
# Get information about the created keys
|
||||
export lines=$(gpg --list-secret-keys --with-colons --with-keygrip)
|
||||
export KEY_ID=""
|
||||
while read -r line
|
||||
do
|
||||
# Save the first key id to be used later
|
||||
if [[ $line =~ "fpr"* ]]; then
|
||||
if [[ $KEY_ID == "" ]]; then
|
||||
KEY_ID="$(echo "$line" | sed -r 's/fpr|://g')"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cache the passphrases for the keys so passwords do not need to be entered
|
||||
if [[ $line =~ "grp"* ]]; then
|
||||
export KEYGRIP_ID="$(echo "$line" | sed -r 's/grp|://g')"
|
||||
/usr/lib/gnupg/gpg-preset-passphrase --preset -P $KEY_PW $KEYGRIP_ID
|
||||
fi
|
||||
done <<< $lines
|
||||
|
||||
# Trust the key
|
||||
touch /tmp/test.txt
|
||||
gpg -a --encrypt -r $KEY_ID --trust-model always --batch --yes /tmp/test.txt
|
||||
echo "trusted-key $KEY_ID" >> ~/.gnupg/gpg.conf
|
||||
|
||||
# Initialize the password store
|
||||
pass init $KEY_ID &>/dev/null
|
||||
|
||||
# Install the vault cli
|
||||
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --batch --yes --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
||||
export lines=$(gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint --with-colons)
|
||||
while read -r line
|
||||
do
|
||||
if [[ $line =~ "fpr"* ]]; then
|
||||
if [[ "$(echo $line | sed -r 's/fpr|://g')" != "798AEC654E5C15428C8E42EEAA16FCBCA621E701" ]]; then
|
||||
echo "HashiCorp key fingerprint does not match expected"
|
||||
exit 1
|
||||
else
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done <<< $lines
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list
|
||||
apt update
|
||||
apt install vault -y
|
||||
|
||||
# Install the docker cli
|
||||
wget -O- https://download.docker.com/linux/debian/gpg | gpg --batch --yes --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt update
|
||||
apt install docker-ce-cli -y
|
||||
|
||||
# Install MongoDB client (mongosh)
|
||||
# Reference: https://www.mongodb.com/docs/mongodb-shell/install/#debian
|
||||
wget -qO- https://www.mongodb.org/static/pgp/server-8.0.asc | tee /etc/apt/trusted.gpg.d/server-8.0.asc
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/server-8.0.asc] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list
|
||||
apt update
|
||||
apt install -y mongodb-mongosh
|
||||
|
||||
# Run Tests
|
||||
unzip /boundary.zip -d /usr/local/bin/
|
||||
cd /src/boundary
|
||||
go test -v -count=1 $TEST_PACKAGE -timeout $TEST_TIMEOUT | tee /testlogs/test-e2e-${TEST_PACKAGE##*/}.log
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright IBM Corp. 2020, 2025
|
||||
# SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
# This script sets up a docker container to serve as a test runner for boundary
|
||||
# e2e tests
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--name test-runner \
|
||||
-e "TEST_PACKAGE=$TEST_PACKAGE" \
|
||||
-e "TEST_TIMEOUT=$TEST_TIMEOUT" \
|
||||
-e "E2E_TESTS=$E2E_TESTS" \
|
||||
-e "BOUNDARY_ADDR=$BOUNDARY_ADDR" \
|
||||
-e "E2E_PASSWORD_AUTH_METHOD_ID=$E2E_PASSWORD_AUTH_METHOD_ID" \
|
||||
-e "E2E_PASSWORD_ADMIN_LOGIN_NAME=$E2E_PASSWORD_ADMIN_LOGIN_NAME" \
|
||||
-e "E2E_PASSWORD_ADMIN_PASSWORD=$E2E_PASSWORD_ADMIN_PASSWORD" \
|
||||
-e "E2E_TARGET_CONTAINER_NAME=$E2E_TARGET_CONTAINER_NAME" \
|
||||
-e "E2E_TARGET_ADDRESS=$E2E_TARGET_ADDRESS" \
|
||||
-e "E2E_TARGET_PORT=$E2E_TARGET_PORT" \
|
||||
-e "E2E_SSH_USER=$E2E_SSH_USER" \
|
||||
-e "E2E_SSH_CA_KEY=$E2E_SSH_CA_KEY" \
|
||||
-e "E2E_SSH_KEY_PATH=/keys/target.pem" \
|
||||
-e "E2E_REGION=$E2E_REGION" \
|
||||
-e "E2E_BUCKET_NAME=$E2E_BUCKET_NAME" \
|
||||
-e "E2E_BUCKET_USER_ID=$E2E_BUCKET_USER_ID" \
|
||||
-e "E2E_BUCKET_ENDPOINT_URL=$E2E_BUCKET_ENDPOINT_URL" \
|
||||
-e "E2E_BUCKET_ACCESS_KEY_ID=$E2E_BUCKET_ACCESS_KEY_ID" \
|
||||
-e "E2E_BUCKET_SECRET_ACCESS_KEY=$E2E_BUCKET_SECRET_ACCESS_KEY" \
|
||||
-e "E2E_MINIO_ALIAS=$E2E_MINIO_ALIAS" \
|
||||
-e "VAULT_ADDR=$VAULT_ADDR_INTERNAL" \
|
||||
-e "VAULT_TOKEN=$VAULT_TOKEN" \
|
||||
-e "E2E_VAULT_ADDR_PUBLIC=$E2E_VAULT_ADDR_PUBLIC" \
|
||||
-e "E2E_VAULT_ADDR_PRIVATE=$E2E_VAULT_ADDR_PRIVATE" \
|
||||
-e "E2E_POSTGRES_USER=$E2E_POSTGRES_USER" \
|
||||
-e "E2E_POSTGRES_PASSWORD=$E2E_POSTGRES_PASSWORD" \
|
||||
-e "E2E_POSTGRES_DB_NAME=$E2E_POSTGRES_DB_NAME" \
|
||||
-e "E2E_POSTGRES_ADDRESS=$E2E_POSTGRES_ADDRESS" \
|
||||
-e "E2E_POSTGRES_PORT=$E2E_POSTGRES_PORT" \
|
||||
-e "E2E_WORKER_TAG_INGRESS=$E2E_WORKER_TAG_INGRESS" \
|
||||
-e "E2E_WORKER_TAG_EGRESS=$E2E_WORKER_TAG_EGRESS" \
|
||||
-e "E2E_WORKER_TAG_COLLOCATED=$E2E_WORKER_TAG_COLLOCATED" \
|
||||
-e "E2E_LDAP_ADDR=$E2E_LDAP_ADDR" \
|
||||
-e "E2E_LDAP_DOMAIN_DN=$E2E_LDAP_DOMAIN_DN" \
|
||||
-e "E2E_LDAP_ADMIN_DN=$E2E_LDAP_ADMIN_DN" \
|
||||
-e "E2E_LDAP_ADMIN_PASSWORD=$E2E_LDAP_ADMIN_PASSWORD" \
|
||||
-e "E2E_LDAP_USER_NAME=$E2E_LDAP_USER_NAME" \
|
||||
-e "E2E_LDAP_USER_PASSWORD=$E2E_LDAP_USER_PASSWORD" \
|
||||
-e "E2E_LDAP_GROUP_NAME=$E2E_LDAP_GROUP_NAME" \
|
||||
-e "E2E_GCP_PRIVATE_KEY_ID=$E2E_GCP_PRIVATE_KEY_ID" \
|
||||
-e "E2E_GCP_PRIVATE_KEY=$E2E_GCP_PRIVATE_KEY" \
|
||||
-e "E2E_GCP_CLIENT_EMAIL=$E2E_GCP_CLIENT_EMAIL" \
|
||||
-e "E2E_GCP_PROJECT_ID=$E2E_GCP_PROJECT_ID" \
|
||||
-e "E2E_GCP_ZONE=$E2E_GCP_ZONE" \
|
||||
-e "E2E_GCP_TARGET_SSH_KEY=$E2E_GCP_TARGET_SSH_KEY" \
|
||||
-e "E2E_GCP_HOST_SET_FILTER1=$E2E_GCP_HOST_SET_FILTER1" \
|
||||
-e "E2E_GCP_HOST_SET_FILTER2=$E2E_GCP_HOST_SET_FILTER2" \
|
||||
-e "E2E_GCP_HOST_SET_IPS=$E2E_GCP_HOST_SET_IPS" \
|
||||
-e "E2E_MAX_PAGE_SIZE=$E2E_MAX_PAGE_SIZE" \
|
||||
-e "E2E_CONTROLLER_CONTAINER_NAME=$E2E_CONTROLLER_CONTAINER_NAME" \
|
||||
--mount type=bind,src=$BOUNDARY_DIR,dst=/src/boundary/ \
|
||||
--mount type=bind,src=$MODULE_DIR/../..,dst=/testlogs \
|
||||
--mount type=bind,src=$(go env GOCACHE),dst=/root/.cache/go-build \
|
||||
--mount type=bind,src=$(go env GOMODCACHE),dst=/go/pkg/mod \
|
||||
-v "$MODULE_DIR/test.sh:/scripts/test.sh" \
|
||||
-v "$E2E_SSH_KEY_PATH:/keys/target.pem" \
|
||||
-v "$BOUNDARY_CLI_DIR:/boundary.zip" \
|
||||
-v "/var/run/docker.sock:/var/run/docker.sock" \
|
||||
--network $TEST_NETWORK_NAME \
|
||||
--cap-add=CAP_IPC_LOCK \
|
||||
$TEST_RUNNER_IMAGE \
|
||||
/bin/sh -c /scripts/test.sh
|
||||
Reference in new issue
Block a user