Skip to content

Commit c810ece

Browse files
authored
Run e2e tests on Kind (kubeflow#2148)
Signed-off-by: Jacob Salway <jacob.salway@gmail.com>
1 parent e8d3de9 commit c810ece

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

.github/workflows/integration.yaml

+11-23
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
done
9292
9393
build-helm-chart:
94-
runs-on: ubuntu-20.04
94+
runs-on: ubuntu-latest
9595
steps:
9696
- name: Determine branch name
9797
id: get_branch
@@ -163,37 +163,25 @@ jobs:
163163
minikube image load docker.io/kubeflow/spark-operator:local
164164
ct install
165165
166-
integration-test:
167-
runs-on: ubuntu-22.04
166+
e2e-test:
167+
runs-on: ubuntu-latest
168168
steps:
169169
- name: Checkout source code
170170
uses: actions/checkout@v4
171171
with:
172-
fetch-depth: "0"
172+
fetch-depth: 0
173173

174174
- name: Set up Go
175175
uses: actions/setup-go@v5
176176
with:
177-
go-version-file: "go.mod"
177+
go-version-file: go.mod
178178

179-
- name: setup minikube
180-
uses: manusa/actions-setup-minikube@v2.11.0
181-
with:
182-
minikube version: v1.33.0
183-
kubernetes version: v1.30.0
184-
start args: --memory 6g --cpus=2 --addons ingress
185-
github token: ${{ inputs.github-token }}
179+
- name: Create a Kind cluster
180+
run: make kind-create-cluster
186181

187-
- name: Build local spark-operator docker image for minikube testing
182+
- name: Build and load image to Kind cluster
188183
run: |
189-
docker build -t docker.io/kubeflow/spark-operator:local .
190-
minikube image load docker.io/kubeflow/spark-operator:local
191-
192-
# The integration tests are currently broken see: https://github.com/kubeflow/spark-operator/issues/1416
193-
# - name: Run chart-testing (integration test)
194-
# run: make integration-test
184+
make kind-load-image IMAGE_TAG=local
195185
196-
- name: Setup tmate session
197-
if: failure()
198-
uses: mxschmitt/action-tmate@v3
199-
timeout-minutes: 15
186+
- name: Run e2e tests
187+
run: make e2e-test

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ endif
246246
.PHONY: kind-create-cluster
247247
kind-create-cluster: kind ## Create a kind cluster for integration tests.
248248
if ! $(KIND) get clusters 2>/dev/null | grep -q "^$(KIND_CLUSTER_NAME)$$"; then \
249-
kind create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG_FILE) --kubeconfig $(KIND_KUBE_CONFIG); \
249+
kind create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG_FILE) --kubeconfig $(KIND_KUBE_CONFIG) --wait=1m; \
250250
fi
251251

252252
.PHONY: kind-load-image
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
nodes:
4+
- role: control-plane
5+
image: kindest/node:v1.29.2
6+
- role: worker
7+
image: kindest/node:v1.29.2

test/e2e/suit_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import (
2727

2828
. "github.com/onsi/ginkgo/v2"
2929
. "github.com/onsi/gomega"
30-
3130
"helm.sh/helm/v3/pkg/action"
3231
"helm.sh/helm/v3/pkg/chart/loader"
32+
"helm.sh/helm/v3/pkg/chartutil"
3333
"helm.sh/helm/v3/pkg/cli"
3434
corev1 "k8s.io/api/core/v1"
3535
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -128,7 +128,10 @@ var _ = BeforeSuite(func() {
128128
chart, err := loader.Load(chartPath)
129129
Expect(err).NotTo(HaveOccurred())
130130
Expect(chart).NotTo(BeNil())
131-
release, err := installAction.Run(chart, nil)
131+
values, err := chartutil.ReadValuesFile(filepath.Join(chartPath, "ci", "ci-values.yaml"))
132+
Expect(err).NotTo(HaveOccurred())
133+
Expect(values).NotTo(BeNil())
134+
release, err := installAction.Run(chart, values)
132135
Expect(err).NotTo(HaveOccurred())
133136
Expect(release).NotTo(BeNil())
134137
})

0 commit comments

Comments
 (0)