UI API Layer Acceptance tests
Overview
This project includes acceptance tests for a UI API Layer project.
Prerequisites
Use the following tools to set up the project:
Development
Install dependencies
This project uses dep
as a dependency manager. To install all required dependencies, use the following command:
dep ensure -vendor-only
Run tests outside the cluster
Before you run the acceptance tests, export required environment variables with the following command:
export ADMIN_EMAIL=$(kubectl get secret admin-user -n kyma-system -o jsonpath="{.data.email}" | base64 -D)
export ADMIN_PASSWORD=$(kubectl get secret admin-user -n kyma-system -o jsonpath="{.data.password}" | base64 -D)
export READ_ONLY_USER_PASSWORD=$(kubectl get secret test-read-only-user -n kyma-system -o jsonpath="{.data.password}" | base64 -D)
export READ_ONLY_USER_EMAIL=$(kubectl get secret test-read-only-user -n kyma-system -o jsonpath="{.data.email}" | base64 -D)
export NO_RIGHTS_USER_PASSWORD=$(kubectl get secret test-no-rights-user -n kyma-system -o jsonpath="{.data.password}" | base64 -D)
export NO_RIGHTS_USER_EMAIL=$(kubectl get secret test-no-rights-user -n kyma-system -o jsonpath="{.data.email}" | base64 -D)
export KUBECONFIG=/Users/${USER}/.kube/config
Run acceptance tests using the following command:
-
against the UI API Layer deployed on the local cluster:
go test ./... -tags=acceptance
-
against standalone UI API Layer deployed on the local host:
GRAPHQL_ENDPOINT=http://localhost:3000/graphql go test ./... -tags=acceptance
-
against the UI API Layer deployed on the cluster with custom domain:
DOMAIN=nightly.kyma.cx go test ./... -tags=acceptance
Verify the code
To check if the code is correct and you can push it, run the before-commit.sh
script. It builds the application, runs tests, checks the status of the vendored libraries, runs the static code analysis, and ensures that the formatting of the code is correct.