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

test(integration): expose KUBE_VERSION #1022

Merged
merged 1 commit into from Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build-test.yaml
Expand Up @@ -62,6 +62,8 @@ jobs:
test-k8s:
needs: build
runs-on: ubuntu-latest
env:
KUBE_VERSION: v1.20.2
steps:
- name: 'Arrange: Check out the repo'
uses: actions/checkout@v2
Expand All @@ -75,6 +77,6 @@ jobs:
docker load < image.tar
docker tag local/kong-ingress-controller:ci localhost:32000/kong-ingress-controller:ci

- name: 'Test: Run integration tests'
- name: 'Test: Run integration tests (k8s ${{ env.KUBE_VERSION }})'
run: |
env KIC_IMAGE=local/kong-ingress-controller:ci ./test/integration/test.sh
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -6,6 +6,7 @@ IMAGE = $(REGISTRY)/$(IMGNAME)
# only for dev
DB?=false
RUN_VERSION?=20
KUBE_VERSION?=v1.20.2

ifndef COMMIT
COMMIT := $(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -62,6 +63,7 @@ container:
run:
./hack/dev/start.sh ${DB} ${RUN_VERSION}


.PHONY: integration-test
integration-test: container
KIC_IMAGE="${IMAGE}:${TAG}" ./test/integration/test.sh
KIC_IMAGE="${IMAGE}:${TAG}" KUBE_VERSION=${KUBE_VERSION} ./test/integration/test.sh
4 changes: 2 additions & 2 deletions test/integration/README.md
Expand Up @@ -24,7 +24,7 @@ This command builds a KIC Docker image and runs the test against that image.
It is possible to run the test against any prebuilt KIC image, skipping the build step:

```bash
env KIC_IMAGE=some-kic-image:tag ./test/integration/test.sh
env KIC_IMAGE=some-kic-image:tag KUBE_VERSION=v1.20.2 ./test/integration/test.sh
```

### Troubleshooting
Expand All @@ -37,7 +37,7 @@ By passing `SKIP_TEARDOWN=yes` to the test you can inspect the test environment
```bash
make SKIP_TEARDOWN=yes integration-test
# or
env KIC_IMAGE=some-kic-image:tag SKIP_TEARDOWN=yes ./test/integration/test.sh
env KIC_IMAGE=some-kic-image:tag KUBE_VERSION=v1.20.2 SKIP_TEARDOWN=yes ./test/integration/test.sh
```

#### Access the test cluster with `kubectl`
Expand Down
5 changes: 4 additions & 1 deletion test/integration/util/create-cluster.sh
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -eu

REGISTRY_PORT=5000
docker run -d --restart=always -p "$REGISTRY_PORT:5000" --name "$REGISTRY_NAME" registry:2
Expand All @@ -9,6 +9,9 @@ KIND_CONFIG="
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
name: $CLUSTER_NAME
nodes:
- role: control-plane
image: 'kindest/node:$KUBE_VERSION'
containerdConfigPatches:
- |-
[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"$REGISTRY_NAME:$REGISTRY_PORT\"]
Expand Down