Fix: E2E Application Test (live-diff application version) (#6976)
Some checks failed
Webhook Upgrade Validation / webhook-upgrade-check (push) Failing after 27s

* refactor: Simplify application auto-update test by removing unnecessary reconciliation waits

Signed-off-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com>

* feat: Add e2e application tests with k3d and webhook validation

Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>

* fix: Remove unnecessary blank line in application auto-update test

Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>

* feat: Add k3d cleanup step after running application tests

Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>

---------

Signed-off-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com>
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Co-authored-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com>
This commit is contained in:
Ayush Kumar
2025-11-11 19:54:30 +05:30
committed by GitHub
parent 0485704cd7
commit 89ff116f8e
2 changed files with 32 additions and 19 deletions

View File

@@ -138,13 +138,6 @@ var _ = Describe("Application Auto update", Ordered, func() {
_, err = e2e.Exec(fmt.Sprintf("%s up -f data/app.yaml", velaCommandPrefix))
Expect(err).NotTo(HaveOccurred())
By("Wait for application to be fully reconciled and v1 revision created")
Eventually(func() bool {
appRev := new(v1beta1.ApplicationRevision)
err := k8sClient.Get(ctx, client.ObjectKey{Name: "app-with-auto-update-v1", Namespace: namespace}, appRev)
return err == nil
}, 30*time.Second, time.Second).Should(BeTrue())
By("Create configmap-component with 1.4.0 version")
updatedComponent := new(v1beta1.ComponentDefinition)
updatedComponentVersion := "1.4.0"
@@ -158,18 +151,9 @@ var _ = Describe("Application Auto update", Ordered, func() {
return k8sClient.Update(ctx, updatedComponent)
}, 15*time.Second, time.Second).Should(BeNil())
By("Trigger application reconciliation by running vela up again to create v2 revision")
Eventually(func() error {
_, err = e2e.Exec(fmt.Sprintf("%s up -f data/app.yaml", velaCommandPrefix))
return err
}, 30*time.Second, 2*time.Second).Should(BeNil())
By("Wait for v2 revision to be created")
Eventually(func() bool {
appRev := new(v1beta1.ApplicationRevision)
err := k8sClient.Get(ctx, client.ObjectKey{Name: "app-with-auto-update-v2", Namespace: namespace}, appRev)
return err == nil
}, 30*time.Second, time.Second).Should(BeTrue())
By("Create application using configmap-component@v1 component")
_, err = e2e.Exec(fmt.Sprintf("%s up -f data/app.yaml", velaCommandPrefix))
Expect(err).NotTo(HaveOccurred())
By("Execute a live-diff command for previous two application versions")
output, err := e2e.Exec(fmt.Sprintf("%s live-diff --revision app-with-auto-update-v2,app-with-auto-update-v1", velaCommandPrefix))

View File

@@ -114,6 +114,35 @@ e2e-test-local:
ginkgo -v ./test/e2e-test
@$(OK) tests pass
# Run e2e application tests with k3d and webhook validation
.PHONY: e2e-application-test-local
e2e-application-test-local:
# Create k3d cluster if needed
@k3d cluster create kubevela-debug --servers 1 --agents 1 || true
# Build and load image
docker build -t vela-core:e2e-test -f Dockerfile . --build-arg=VERSION=e2e-test --build-arg=GITVERSION=test
k3d image import vela-core:e2e-test -c kubevela-debug
# Deploy with Helm
kubectl delete validatingwebhookconfiguration kubevela-vela-core-admission 2>/dev/null || true
helm upgrade --install kubevela ./charts/vela-core \
--namespace vela-system --create-namespace \
--set image.repository=vela-core \
--set image.tag=e2e-test \
--set image.pullPolicy=IfNotPresent \
--set admissionWebhooks.enabled=true \
--set featureGates.enableCueValidation=true \
--set featureGates.validateResourcesExist=true \
--set applicationRevisionLimit=5 \
--set controllerArgs.reSyncPeriod=1m \
--wait --timeout 3m
# Clean up any leftover vela resources from previous test runs
@vela ls -n default --quiet 2>/dev/null | tail -n +2 | awk '{print $$1}' | xargs -I {} vela delete {} -n default -y 2>/dev/null || true
@vela env delete env-application 2>/dev/null || true
# Run application tests
ginkgo -v -r e2e/application
@$(OK) tests pass
@$(MAKE) k3d-delete
# Run main_e2e_test.go with k3d cluster and embedded test binary
.PHONY: e2e-test-main-local
e2e-test-main-local: