test: add e2e framework and test runner#67
Conversation
Signed-off-by: kaffie-1517 <jasmeetsingh171002@gmail.com>
Signed-off-by: kaffie-1517 <jasmeetsingh171002@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive E2E testing suite for Volcano-Global, including deployment automation, test execution scripts, and a multi-cluster testing framework. Feedback focuses on improving the robustness and portability of the environment by pinning tool versions and disabling CGO, while also suggesting the parameterization of hardcoded cluster names and dependency versions to enhance framework flexibility.
|
|
||
| # Install ginkgo | ||
| echo "Installing ginkgo..." | ||
| GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo@latest |
There was a problem hiding this comment.
Installing ginkgo with @latest can lead to non-deterministic test environments if a new version is released with breaking changes. It is better to pin the version to match the one defined in go.mod.
| GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo@latest | |
| GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo@v2.28.1 |
| kubectl --context karmada-apiserver get ns default >/dev/null | ||
|
|
||
| set +e | ||
| GOOS=$(go env GOHOSTOS) GOARCH=$(go env GOHOSTARCH) CGO_ENABLED=1 \ |
There was a problem hiding this comment.
Setting CGO_ENABLED=1 might cause build failures in environments without a C compiler (like some CI runners). Since E2E tests typically only perform API calls, CGO is likely unnecessary. Consider setting it to 0 for better portability.
| GOOS=$(go env GOHOSTOS) GOARCH=$(go env GOHOSTARCH) CGO_ENABLED=1 \ | |
| GOOS=$(go env GOHOSTOS) GOARCH=$(go env GOHOSTARCH) CGO_ENABLED=0 \ |
| IMAGE_PREFIX=${IMAGE_PREFIX:-"volcanosh"} | ||
| KARMADA_KUBECONFIG=${KARMADA_KUBECONFIG:-"${HOME}/.kube/karmada.config"} | ||
| KARMADA_HOST_CLUSTER=${KARMADA_HOST_CLUSTER:-"karmada-host"} | ||
| VOLCANO_VERSION=${VOLCANO_VERSION:-"release-1.10"} |
There was a problem hiding this comment.
The default VOLCANO_VERSION is set to release-1.10, but the project appears to be using a much newer version (v1.14.0-alpha.0 according to go.mod). Using an outdated version for CRDs might lead to compatibility issues.
| VOLCANO_VERSION=${VOLCANO_VERSION:-"release-1.10"} | |
| VOLCANO_VERSION=${VOLCANO_VERSION:-"master"} |
Signed-off-by: kaffie-1517 <jasmeetsingh171002@gmail.com>
Signed-off-by: kaffie-1517 <jasmeetsingh171002@gmail.com>
Signed-off-by: kaffie-1517 <jasmeetsingh171002@gmail.com>
|
Thanks @kaffie-1517, but I didn't see any github workflow has been added in this PR, did you miss it? With github workflow, we can know that whether a PR will have bugs or have influence before the merge, and it's better for me to judge your PR, no need to build the clusters from the scratch |
Summary
This PR adds the Ginkgo e2e test framework, runner scripts, and Go module dependencies needed to write and execute end-to-end tests for volcano-global. It provides shared multi-cluster clients, CRUD + wait helpers for every volcano-global resource type, and a
make e2e-testentrypoint.Changes in this PR
test/e2e/framework/clients.go: sharedClientsstruct holding Karmada, host, member Kube + Volcano clientsetstest/e2e/framework/framework.go:BeforeSuiteinit, namespace helpers, polling constants, CLI flags for kubeconfig pathstest/e2e/framework/vcjob.go: Create / Delete / Get / WaitForStatus helpers for VCJobtest/e2e/framework/queue.go: Create / Delete / Get / WaitForOpen helpers for Queuetest/e2e/framework/propagationpolicy.go: Create / Delete helpers for PropagationPolicytest/e2e/framework/resourcebinding.go: WaitForSuspended / WaitForUnsuspended / WaitForExists helpers for ResourceBindingtest/e2e/framework/hyperjob.go: Create / Delete / Get / WaitForChildJobs helpers for HyperJobtest/e2e/e2e_suite_test.go: Ginkgo bootstrap that registers the framework and runs all suiteshack/e2e.sh: top-level entrypoint withSKIP_SETUPsupport (callssetup-e2e-env.shthenrun-e2e.sh)hack/run-e2e.sh: installs ginkgo, ensures PATH, overridesGOOS/CGO_ENABLEDfor local runs, runs tests with--race --fail-fast -p, collects Kind + pod logsgo.mod/go.sum: addginkgo/v2,gomega, and transitive depsMakefile: adde2e-testtargetFollow-up changes
Test plan
Run the e2e tests locally against an existing Karmada + Volcano environment:
Verify Ginkgo discovers and executes suites:
Confirm all framework helpers compile:
Liked issue: