Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add app-gateway k3d integration test #18604

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/kyma-integration-k3d-app-gateway.yml
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package httptools

// TODO:remove me

import (
"io"
"net/http"
Expand Down
76 changes: 57 additions & 19 deletions tests/components/application-connector/hack/ci/Makefile
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 ?= ../../../../..
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 ../../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)

Loading