Skip to content

Commit

Permalink
chore: E2E fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiwalyajoshi committed Mar 4, 2024
1 parent 3eee897 commit ecbad74
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,54 @@ on:
branches:
- d2iq/*

env:
CLUSTERCTL_VERSION: "v1.4.0"
KUBERNETES_VERSION: "v1.28.7"
CAPI_PROVIDERS_WAIT_TIMEOUT: "300"
CAPI_VERSION: "v1.4.0"
KUBEADM_VERSION: "v1.4.0"
CAPVCD_VERSION: "v1.1.0"
CLUSTER_TEMPLATE: "cluster-template-v1.27.5-tkgv2.4.0.yaml"

jobs:
test:
name: Test
runs-on:
- self-hosted
- small
# - ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true # cache go action in github actions cache store.
- name: make test
run: make test

- name: Setup clusterctl
run: |
GOARCH=$(go env GOARCH)
GOOS=$(go env GOOS)
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/${{ env.CLUSTERCTL_VERSION }}/clusterctl-"${GOOS}"-"${GOARCH}" -o clusterctl
chmod ug+rx ./clusterctl
- name: Create KinD Cluster
uses: helm/kind-action@v1
with:
version: "v0.22.0"
node_image: "ghcr.io/mesosphere/kind-node:${{ env.KUBERNETES_VERSION }}"
kubectl_version: ${{ env.KUBERNETES_VERSION }}
cluster_name: kind

- name: Install required CAPI Components
run: |
./clusterctl version
./clusterctl init --wait-providers --wait-provider-timeout ${{ env.CAPI_PROVIDERS_WAIT_TIMEOUT }} --core cluster-api:${{ env.CAPI_VERSION }} -b kubeadm:${{ env.KUBEADM_VERSION }} -c kubeadm:${{ env.KUBEADM_VERSION }} -i vcd:${{ env.CAPVCD_VERSION }}
kubectl get pods -A -o wide
- name: make test-e2e
run: |
GITROOT=$(git rev-parse --show-toplevel)
export TEMPLATE_FILE="${GITROOT}/templates/${{ env.CLUSTER_TEMPLATE }}"
export KUBECONFIG=~/.kube/config
make test-e2e
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ GOLANGCI_LINT ?= bin/golangci-lint
GOSEC ?= bin/gosec
SHELLCHECK ?= bin/shellcheck

KUBECONFIG ?= $(HOME)/.kube/config
TEMPLATE_FILE ?= $(GITROOT)/templates/cluster-template.yaml

TEST_PACKAGES := ./...

.PHONY: all
Expand Down Expand Up @@ -142,6 +145,10 @@ test: manifests generate ## Run tests.
setup_envtest_env "$(shell pwd)/bin/testbin"; \
go test $(TEST_PACKAGES) -coverprofile cover.out

.PHONY: test-e2e
test-e2e: manifests generate ## Run tests.
go test ./tests/e2e -coverprofile cover.out -args -PathToMngmntClusterKubecfg=${KUBECONFIG} -PathToWorkloadClusterCapiYaml=${TEMPLATE_FILE}

.PHONY: manager
manager: generate ## Build manager binary.
@mkdir -p bin
Expand Down

0 comments on commit ecbad74

Please sign in to comment.