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

Run e2e tests on Kind #2148

Merged
merged 1 commit into from
Sep 3, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
done

build-helm-chart:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
Copy link
Member Author

@jacobsalway jacobsalway Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any specific dependency on Ubuntu version in these commands and across the projects I've seen it seems common to run actions on ubuntu-latest.

steps:
- name: Determine branch name
id: get_branch
Expand Down Expand Up @@ -163,37 +163,25 @@ jobs:
minikube image load docker.io/kubeflow/spark-operator:local
ct install

integration-test:
runs-on: ubuntu-22.04
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
go-version-file: go.mod

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

- name: Build local spark-operator docker image for minikube testing
- name: Build and load image to Kind cluster
run: |
docker build -t docker.io/kubeflow/spark-operator:local .
minikube image load docker.io/kubeflow/spark-operator:local

# The integration tests are currently broken see: https://github.com/kubeflow/spark-operator/issues/1416
# - name: Run chart-testing (integration test)
# run: make integration-test
make kind-load-image IMAGE_TAG=local

- name: Setup tmate session
if: failure()
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
- name: Run e2e tests
run: make e2e-test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ endif
.PHONY: kind-create-cluster
kind-create-cluster: kind ## Create a kind cluster for integration tests.
if ! $(KIND) get clusters 2>/dev/null | grep -q "^$(KIND_CLUSTER_NAME)$$"; then \
kind create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG_FILE) --kubeconfig $(KIND_KUBE_CONFIG); \
kind create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG_FILE) --kubeconfig $(KIND_KUBE_CONFIG) --wait=1m; \
Copy link
Member Author

@jacobsalway jacobsalway Aug 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for the control plane to become ready before returning success from this target seems sensible to me. I've always used this flag when running kind create cluster myself.

fi

.PHONY: kind-load-image
Expand Down
7 changes: 7 additions & 0 deletions charts/spark-operator-chart/ci/kind-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.29.2
- role: worker
image: kindest/node:v1.29.2
7 changes: 5 additions & 2 deletions test/e2e/suit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/cli"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -128,7 +128,10 @@ var _ = BeforeSuite(func() {
chart, err := loader.Load(chartPath)
Expect(err).NotTo(HaveOccurred())
Expect(chart).NotTo(BeNil())
release, err := installAction.Run(chart, nil)
values, err := chartutil.ReadValuesFile(filepath.Join(chartPath, "ci", "ci-values.yaml"))
Expect(err).NotTo(HaveOccurred())
Expect(values).NotTo(BeNil())
release, err := installAction.Run(chart, values)
Expect(err).NotTo(HaveOccurred())
Expect(release).NotTo(BeNil())
})
Expand Down