Test e2e cluster

From GoogleCloudPlatform/k8s-bridge · View interactive version

Test e2e cluster is an AI agent skill from the GitHub repository GoogleCloudPlatform/k8s-bridge. Runs, writes, and debugs full-stack end-to-end (E2E) Ginkgo test suites and cluster test harnesses against a local Kind CPU cluster or a GKE GPU Kubernetes cluster. Use when executing make test-e2e, make test-e2e-gpu, or make run-test-e2e-gpu, adding new E2E test specs in test/e2e/, or debugging E2E

How to use this skill

Skill file

End-to-End (E2E) Cluster Testing Workflow (`test-e2e-cluster`)

1. Preconditions & Inputs

Before running or modifying E2E suites, verify:


2. Guardrails


3. Step-by-Step Procedure

Select the step matching your target E2E task (do not run Steps 1, 2, and 3 together):

Step 1: Run Full Local Kind CPU E2E Suite (`make test-e2e`)

Run the full Kind CPU E2E lifecycle (cluster setup, image build/load, Ginkgo suite, and teardown):

make test-e2e

Step 2: Run Focused Ginkgo Specs Against an Existing Kind Cluster

Create the Kind cluster once via make setup-test-e2e, run focused specs with KIND and KIND_CLUSTER set, and tear down via make cleanup-test-e2e when finished:

KIND=./bin/kind KIND_CLUSTER=k8s-bridge-test-e2e go test -tags=e2e ./test/e2e/ -v -ginkgo.v -ginkgo.focus="<spec pattern>" -timeout 20m

Step 3: Run GKE GPU E2E Suite (`make test-e2e-gpu` vs `make run-test-e2e-gpu`)

  1. Configure .env in the repository root with GCP_PROJECT and the GPU test variables listed in Makefile (##@ E2E GPU Testing). When testing local code changes on GKE (INFRA_PROVIDER=gke), build and push IMG first (make docker-build docker-push IMG=$IMG; see README.md #### GPU E2E Tests on a Provided Cluster).
  2. Full lifecycle (provision GKE cluster + run tests + tear down cluster): After user confirmation, run make test-e2e-gpu IMG=$IMG.
  3. Existing cluster execution (skip cluster creation and teardown): When the GKE GPU cluster is already running in kubectl config current-context, run make run-test-e2e-gpu IMG=$IMG.

Step 4: Write New E2E Test Specs (`test/e2e/`)

Reuse the E2E job submission (DefaultSlurmTestUser), state verification, and cluster reset helpers in test/utils/slurm.go, test/utils/login_node.go, and test/utils/jobset.go, following the patterns in test/e2e/e2e_test.go, test/e2e/slurm_flag_rejection_test.go, and test/e2e/gpu/gpu_test.go.


4. Verification

  1. Verify the Ginkgo suite passes and any temporary Kind/GKE test cluster created by make test-e2e or make test-e2e-gpu was cleaned up.
  2. Run make fmt vet lint after editing any files under test/.

5. Handoffs & Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.