Revert e2e parallel

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
This commit is contained in:
faizanahmad055
2026-05-11 22:24:34 +02:00
parent caebfd98f9
commit 2d1c05ef5e
18 changed files with 87 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Auto Reload All Flag Tests", func() {
var _ = Describe("Auto Reload All Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string

View File

@@ -2,6 +2,7 @@ package flags
import (
"context"
"encoding/json"
"testing"
. "github.com/onsi/ginkgo/v2"
@@ -23,25 +24,55 @@ func TestFlags(t *testing.T) {
RunSpecs(t, "Flag-Based E2E Suite")
}
var _ = BeforeSuite(func() {
var err error
ctx = context.Background()
// SynchronizedBeforeSuite ensures only process 1 creates the shared namespace.
// The flags tests each deploy/undeploy Reloader themselves (marked Serial), so
// there is no shared Reloader instance — only the namespace is shared.
var _ = SynchronizedBeforeSuite(
// Process 1 only: create namespace, build clients.
func() []byte {
setupEnv, err := utils.SetupTestEnvironment(context.Background(), "reloader-flags")
Expect(err).NotTo(HaveOccurred(), "Failed to setup test environment")
// Ensure the namespace is cleaned up if setup fails.
DeferCleanup(setupEnv.CleanupOnFailure)
testEnv, err = utils.SetupTestEnvironment(ctx, "reloader-flags")
Expect(err).NotTo(HaveOccurred(), "Failed to setup test environment")
data, err := json.Marshal(utils.SharedEnvData{
Namespace: setupEnv.Namespace,
ReleaseName: setupEnv.ReleaseName,
})
Expect(err).NotTo(HaveOccurred())
return data
},
// All processes (including #1): connect to the shared namespace.
func(data []byte) {
var shared utils.SharedEnvData
Expect(json.Unmarshal(data, &shared)).To(Succeed())
kubeClient = testEnv.KubeClient
testNamespace = testEnv.Namespace
})
var err error
testEnv, err = utils.SetupSharedTestEnvironment(context.Background(), shared.Namespace, shared.ReleaseName)
Expect(err).NotTo(HaveOccurred(), "Failed to setup shared test environment")
var _ = AfterSuite(func() {
if testEnv != nil {
err := testEnv.Cleanup()
Expect(err).NotTo(HaveOccurred(), "Failed to cleanup test environment")
}
kubeClient = testEnv.KubeClient
testNamespace = testEnv.Namespace
ctx = testEnv.Ctx
},
)
GinkgoWriter.Println("Flags E2E Suite cleanup complete")
})
var _ = SynchronizedAfterSuite(
// All processes: cancel the per-process context.
func() {
if testEnv != nil {
testEnv.Cancel()
}
},
// Process 1 only (runs last): delete namespace.
func() {
if testEnv != nil {
err := testEnv.Cleanup()
Expect(err).NotTo(HaveOccurred(), "Failed to cleanup test environment")
}
GinkgoWriter.Println("Flags E2E Suite cleanup complete")
},
)
// deployReloaderWithFlags deploys Reloader with the specified Helm value overrides.
// This is a convenience function for tests that need to deploy with specific flags.

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Ignore Resources Flag Tests", func() {
var _ = Describe("Ignore Resources Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Ignored Workloads Flag Tests", func() {
var _ = Describe("Ignored Workloads Flag Tests", Serial, func() {
var (
cronJobName string
configMapName string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Namespace Ignore Flag Tests", func() {
var _ = Describe("Namespace Ignore Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Namespace Selector Flag Tests", func() {
var _ = Describe("Namespace Selector Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Reload On Create Flag Tests", func() {
var _ = Describe("Reload On Create Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Reload On Delete Flag Tests", func() {
var _ = Describe("Reload On Delete Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Resource Label Selector Flag Tests", func() {
var _ = Describe("Resource Label Selector Flag Tests", Serial, func() {
var (
deploymentName string
matchingCM string

View File

@@ -9,7 +9,7 @@ import (
"github.com/stakater/Reloader/test/e2e/utils"
)
var _ = Describe("Watch Globally Flag Tests", func() {
var _ = Describe("Watch Globally Flag Tests", Serial, func() {
var (
deploymentName string
configMapName string