added changes to make local e2e test work/ update doc (#2036)

* added changes to make local e2e test work/ update doc
This commit is contained in:
Jeremy Facchetti 2022-04-07 04:29:15 +02:00 коммит произвёл GitHub
Родитель 5afa1b7f61
Коммит 4dbe573e02
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 38 добавлений и 5 удалений

Просмотреть файл

@ -35,11 +35,14 @@ For faster feedback, you may want to set up [golanglint-ci's editor integration]
E2e tests can be run in CI with the `/azp run e2e` command in your GitHub PR.
E2e tests can also be run locally as follows:
- Deploy or use an existing cosmos database
- Run the RP
- Make sure that you meet the requirements from [Prepare the database and run the rp](./deploy-development-rp.md) (do not create the database yet)
- Source the [helper script](../hack/e2e/run-rp-and-e2e.sh) to set the proper ENV variables. If you run the tests locally, run `export LOCAL_E2E=true` env before sourcing the helper file.
- Run the rp
- Validate the RP is running properly by hitting the `/healthz` route
- Register a subscription where to run the e2e
- Create an openshift cluster
- Run the `make test-e2e` target
- Delete the openshift cluster, if applicable
- Delete the cosmos database, if applicable
You can also modify the flags passed to the e2e.test run by setting the E2E_FLAGS environment variable before running `make test-e2e`.
@ -48,15 +51,23 @@ These steps can be acheived using commands below. Look at the [e2e helper
file](../hack/e2e/run-rp-and-e2e.sh) to understand each of the bash functions
below.
### Run a specific test
End to end tests are run using ginkgo. You can run subsets of tests or ignore some tests by following the [ginkgo documentation](https://onsi.github.io/ginkgo/#filtering-specs)
```bash
# source your environment file
. ./secrets/env
# set the LOCAL_E2E env if you are testing locally
export LOCAL_E2E="true"
# source the e2e helper file
. ./hack/e2e/run-rp-and-e2e.sh
# Deploy a new DB
# Deploy a new DB if it does not exist yet
deploy_e2e_db
# build the rp binary
@ -68,12 +79,18 @@ run_rp
# validate if the RP is ready to receive requests
validate_rp_running
# create an openshift cluster if it does not exist yet
go run ./hack/cluster create
# Register the sub you are using to run e2e
register_sub
# Run e2e
make test-e2e
# delete the openshift cluster if applicable
go run ./hack/cluster delete
# Stop the local RP
kill_rp

Просмотреть файл

@ -69,8 +69,24 @@ clean_e2e_db(){
# TODO: CLUSTER and is also recalculated in multiple places
# in the billing pipelines :-(
export CLUSTER="v4-e2e-V$BUILD_BUILDID-$LOCATION"
export DATABASE_NAME="v4-e2e-V$BUILD_BUILDID-$LOCATION"
# if LOCAL_E2E is set, set the value with the local test names
# If it it not set, it defaults to the build ID
if [ -z "${LOCAL_E2E}" ] ; then
export CLUSTER="v4-e2e-V$BUILD_BUILDID-$LOCATION"
export DATABASE_NAME="v4-e2e-V$BUILD_BUILDID-$LOCATION"
fi
if [ -z "${CLUSTER}" ] ; then
echo "CLUSTER is not set , aborting"
exit 1
fi
if [ -z "${DATABASE_NAME}" ] ; then
echo "DATABASE_NAME is not set , aborting"
exit 1
fi
echo "######################################"
echo "##### ARO V4 E2e helper sourced ######"