forked from kyma-project/kyma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add app-gateway k3d integration test
- Loading branch information
Showing
3 changed files
with
87 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Run app-gateway integration tests on k3d | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'components/central-application-gateway/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'components/central-application-gateway/**' | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
/home/runner/work/common/bin | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run unit tests | ||
run: make -C tests/components/application-connector/hack/ci k3d-gateway-tests PROJECECT_ROOT=$PWD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package httptools | ||
|
||
// TODO:remove me | ||
|
||
import ( | ||
"io" | ||
"net/http" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,72 @@ | ||
PROJECT_ROOT ?= ../.. | ||
KYMA_ROOT_CI ?= /home/prow/go/src/github.com/kyma-project/kyma | ||
.PHONY: setup-environment run-gateway-tests run-validator-tests run-agent-test | ||
|
||
.ONESHELL: | ||
setup-environment: | ||
set -e | ||
k3d registry create k3d-registry --port 5000 | ||
k3d cluster create k3d --registry-use k3d-k3d-registry:5000 | ||
kubectl cluster-info | ||
CLI_VERSION=$(shell curl -s https://api.github.com/repos/kyma-project/cli/releases/latest | grep tag_name | cut -d '"' -f 4); \ | ||
curl -Lo kyma.tar.gz https://github.com/kyma-project/cli/releases/download/$$CLI_VERSION/kyma_Linux_x86_64.tar.gz && mkdir kyma-release && tar -C kyma-release -zxvf kyma.tar.gz && chmod +x kyma-release/kyma && mv kyma-release/kyma /usr/local/bin && rm -rf kyma-release kyma.tar.gz | ||
K3D_URL=https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | ||
|
||
PROJECT_ROOT ?= $(shell pwd) | ||
CLUSTER_NAME ?= kyma | ||
REGISTRY_PORT ?= 5001 | ||
REGISTRY_NAME ?= ${CLUSTER_NAME}-registry | ||
|
||
# Operating system architecture | ||
OS_ARCH ?= $(shell uname -m) | ||
|
||
# Operating system type | ||
OS_TYPE ?= $(shell uname) | ||
|
||
.PHONY: setup-environment run-gateway-tests run-validator-tests run-agent-test install-k3d | ||
|
||
.PHONY: install-k3d | ||
install-k3d: | ||
curl --silent --fail ${K3D_URL} | TAG=${DEFAULT_K3D_VERSION} bash | ||
|
||
setup-environment: kyma install-k3d ## Setup environment for tests | ||
${KYMA} provision k3d \ | ||
--registry-port ${REGISTRY_PORT} \ | ||
--name ${CLUSTER_NAME} \ | ||
-p 8080:80@loadbalancer \ | ||
-p 8443:443@loadbalancer \ | ||
--ci | ||
|
||
k3d-gateway-tests: setup-environment | ||
apk add openssl | ||
kyma deploy --ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-os.yaml --source=local --workspace ${KYMA_ROOT_CI} | ||
cd ${PROJECT_ROOT} | ||
${KYMA} deploy \ | ||
--ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-os.yaml \ | ||
--source=local \ | ||
--workspace ${PROJECT_ROOT} | ||
make -f Makefile.test-application-gateway test | ||
k3d cluster delete | ||
|
||
|
||
k3d-validator-tests: setup-environment | ||
kyma deploy --ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-skr.yaml --value global.disableLegacyConnectivity=true --source=local --workspace ${KYMA_ROOT_CI} | ||
${KYMA} deploy --ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-skr.yaml --value global.disableLegacyConnectivity=true --source=local --workspace ${KYMA_ROOT_CI} | ||
cd ${PROJECT_ROOT} | ||
make -f Makefile.test-application-conn-validator test | ||
k3d cluster delete | ||
|
||
k3d-agent-tests: setup-environment | ||
kyma deploy --ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-skr.yaml --value global.disableLegacyConnectivity=true --value compassRuntimeAgent.director.proxy.insecureSkipVerify=true --source=local --workspace ${KYMA_ROOT_CI} | ||
${KYMA} deploy --ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-skr.yaml --value global.disableLegacyConnectivity=true --value compassRuntimeAgent.director.proxy.insecureSkipVerify=true --source=local --workspace ${KYMA_ROOT_CI} | ||
kubectl apply -f ${PROJECT_ROOT}/resources/patches/coredns.yaml | ||
kubectl -n kube-system delete pods -l k8s-app=kube-dns | ||
cd ${PROJECT_ROOT} | ||
make -f Makefile.test-compass-runtime-agent test | ||
k3d cluster delete | ||
k3d cluster delete | ||
|
||
##@ Tools | ||
|
||
## Location to install dependencies to | ||
LOCALBIN ?= $(shell pwd)/bin | ||
$(LOCALBIN): | ||
mkdir -p $(LOCALBIN) | ||
|
||
########## Kyma CLI ########### | ||
KYMA_STABILITY ?= unstable | ||
|
||
define os_error | ||
$(error Error: unsuported platform OS_TYPE:$1, OS_ARCH:$2; to mitigate this problem set variable KYMA with absolute path to kyma-cli binary compatible with your operating system and architecture) | ||
endef | ||
|
||
KYMA_FILE_NAME ?= kyma-linux | ||
|
||
KYMA ?= $(LOCALBIN)/kyma-$(KYMA_STABILITY) | ||
kyma: $(LOCALBIN) $(KYMA) ## Download kyma locally if necessary. | ||
$(KYMA): | ||
$(if $(KYMA_FILE_NAME),,$(call os_error, ${OS_TYPE}, ${OS_ARCH})) | ||
test -f $@ || curl -s -Lo $(KYMA) https://storage.googleapis.com/kyma-cli-$(KYMA_STABILITY)/$(KYMA_FILE_NAME) | ||
chmod 0100 $(KYMA) | ||
|