From 93646cc8ede27e51e1188a3c1ac017cfa9ca9fbf Mon Sep 17 00:00:00 2001 From: KevFan Date: Tue, 7 May 2024 17:31:50 +0100 Subject: [PATCH 1/4] feat: allow integration tests to run concurrently --- Makefile | 11 ++- .../limitador_controller_affinity_test.go | 6 +- .../limitador_controller_limits_sync_test.go | 6 +- .../limitador_controller_limits_test.go | 6 +- controllers/limitador_controller_pdb_test.go | 4 +- .../limitador_controller_ports_test.go | 6 +- .../limitador_controller_replicas_test.go | 8 +- .../limitador_controller_resources_test.go | 6 +- controllers/limitador_controller_test.go | 20 ++--- .../limitador_controller_version_test.go | 6 +- controllers/suite_test.go | 74 ++++++++++++++++--- 11 files changed, 108 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index ab54bde2..c8a9b2a0 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,8 @@ IMG ?= $(DEFAULT_IMG) UNIT_DIRS := ./pkg/... ./api/... INTEGRATION_TEST_SUITE_PATHS := ./controllers/... INTEGRATION_COVER_PKGS := ./pkg/...,./controllers/...,./api/... +INTEGRATION_TEST_NUM_CORES ?= 4 +INTEGRATION_TEST_NUM_PROCESSES ?= 10 # Limitador Operator replaced version DEFAULT_REPLACES_VERSION = 0.0.0-alpha @@ -228,8 +230,15 @@ test-integration: clean-cov generate fmt vet ginkgo ## Run Integration tests. --coverpkg $(INTEGRATION_COVER_PKGS) \ --output-dir $(PROJECT_PATH)/coverage/integration \ --coverprofile cover.out \ - --fail-fast \ -v \ + --compilers=$(INTEGRATION_TEST_NUM_CORES) \ + --procs=$(INTEGRATION_TEST_NUM_PROCESSES) \ + --randomize-all \ + --randomize-suites \ + --fail-on-pending \ + --keep-going \ + --race \ + --trace \ $(INTEGRATION_TEST_SUITE_PATHS) ifdef TEST_NAME diff --git a/controllers/limitador_controller_affinity_test.go b/controllers/limitador_controller_affinity_test.go index 0d06f17e..42e26aa4 100644 --- a/controllers/limitador_controller_affinity_test.go +++ b/controllers/limitador_controller_affinity_test.go @@ -23,7 +23,7 @@ var _ = Describe("Limitador controller manages affinity", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -55,7 +55,7 @@ var _ = Describe("Limitador controller manages affinity", func() { limitadorObj.Spec.Affinity = affinity Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create a new deployment with the custom affinity", func(ctx SpecContext) { deployment := appsv1.Deployment{} @@ -98,7 +98,7 @@ var _ = Describe("Limitador controller manages affinity", func() { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify the deployment with the affinity custom settings", func(ctx SpecContext) { deployment := appsv1.Deployment{} diff --git a/controllers/limitador_controller_limits_sync_test.go b/controllers/limitador_controller_limits_sync_test.go index 26ce01bd..5751df51 100644 --- a/controllers/limitador_controller_limits_sync_test.go +++ b/controllers/limitador_controller_limits_sync_test.go @@ -31,7 +31,7 @@ var _ = Describe("Limitador controller syncs limits to pod", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -63,7 +63,7 @@ var _ = Describe("Limitador controller syncs limits to pod", func() { limitadorObj.Spec.Limits = limits Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should annotate limitador pods with annotation of limits cm resource version", func(ctx SpecContext) { podList := &corev1.PodList{} @@ -117,7 +117,7 @@ var _ = Describe("Limitador controller syncs limits to pod", func() { limitadorObj.Spec.Limits = limits Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should update limitador pods annotation and sync config map to pod", func(ctx SpecContext) { // Check cm resource version of pods before update diff --git a/controllers/limitador_controller_limits_test.go b/controllers/limitador_controller_limits_test.go index adf866fc..80761885 100644 --- a/controllers/limitador_controller_limits_test.go +++ b/controllers/limitador_controller_limits_test.go @@ -23,7 +23,7 @@ var _ = Describe("Limitador controller manages limits", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -55,7 +55,7 @@ var _ = Describe("Limitador controller manages limits", func() { limitadorObj.Spec.Limits = limits Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create configmap with the custom limits", func(ctx SpecContext) { cm := &v1.ConfigMap{} @@ -99,7 +99,7 @@ var _ = Describe("Limitador controller manages limits", func() { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify configmap with the new limits", func(ctx SpecContext) { cm := &v1.ConfigMap{} diff --git a/controllers/limitador_controller_pdb_test.go b/controllers/limitador_controller_pdb_test.go index adde4700..619e5a30 100644 --- a/controllers/limitador_controller_pdb_test.go +++ b/controllers/limitador_controller_pdb_test.go @@ -24,7 +24,7 @@ var _ = Describe("Limitador controller manages PodDisruptionBudget", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -41,7 +41,7 @@ var _ = Describe("Limitador controller manages PodDisruptionBudget", func() { limitadorObj.Spec.PodDisruptionBudget = pdbType Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create PodDisruptionBudget", func(ctx SpecContext) { pdb := &policyv1.PodDisruptionBudget{} diff --git a/controllers/limitador_controller_ports_test.go b/controllers/limitador_controller_ports_test.go index 88230c80..cc660ec1 100644 --- a/controllers/limitador_controller_ports_test.go +++ b/controllers/limitador_controller_ports_test.go @@ -26,7 +26,7 @@ var _ = Describe("Limitador controller manages ports", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -48,7 +48,7 @@ var _ = Describe("Limitador controller manages ports", func() { } Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should configure k8s resources with the custom ports", func(ctx SpecContext) { // Deployment ports @@ -142,7 +142,7 @@ var _ = Describe("Limitador controller manages ports", func() { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify the k8s resources with the custom ports", func(ctx SpecContext) { deployment := appsv1.Deployment{} diff --git a/controllers/limitador_controller_replicas_test.go b/controllers/limitador_controller_replicas_test.go index 1568b197..3f7749c0 100644 --- a/controllers/limitador_controller_replicas_test.go +++ b/controllers/limitador_controller_replicas_test.go @@ -22,7 +22,7 @@ var _ = Describe("Limitador controller manages replicas", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -38,7 +38,7 @@ var _ = Describe("Limitador controller manages replicas", func() { limitadorObj.Spec.Replicas = ptr.To(int(replicas)) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create a new deployment with the custom replicas", func(ctx SpecContext) { deployment := appsv1.Deployment{} @@ -62,8 +62,8 @@ var _ = Describe("Limitador controller manages replicas", func() { BeforeEach(func(ctx SpecContext) { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) - Eventually(testLimitadorIsReady(ctx, limitadorObj), time.Minute, 5*time.Second).Should(Succeed()) - }, nodeTimeOut) + Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) + }) It("Should modify deployment replicas", func(ctx SpecContext) { deployment := appsv1.Deployment{} diff --git a/controllers/limitador_controller_resources_test.go b/controllers/limitador_controller_resources_test.go index b940194d..273be462 100644 --- a/controllers/limitador_controller_resources_test.go +++ b/controllers/limitador_controller_resources_test.go @@ -23,7 +23,7 @@ var _ = Describe("Limitador controller manages resource requirements", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -41,7 +41,7 @@ var _ = Describe("Limitador controller manages resource requirements", func() { limitadorObj.Spec.ResourceRequirements = &resourceRequirements Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create a new deployment with the custom resource requirements", func(ctx SpecContext) { deployment := appsv1.Deployment{} @@ -70,7 +70,7 @@ var _ = Describe("Limitador controller manages resource requirements", func() { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify deployment resource requirements", func(ctx SpecContext) { deployment := appsv1.Deployment{} diff --git a/controllers/limitador_controller_test.go b/controllers/limitador_controller_test.go index 3988692f..9192e775 100644 --- a/controllers/limitador_controller_test.go +++ b/controllers/limitador_controller_test.go @@ -38,7 +38,7 @@ var _ = Describe("Limitador controller", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -51,7 +51,7 @@ var _ = Describe("Limitador controller", func() { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create a Limitador service with default ports", func(ctx SpecContext) { createdLimitadorService := corev1.Service{} @@ -182,7 +182,7 @@ var _ = Describe("Limitador controller", func() { Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create a new deployment with rate limit headers command line arg", func(ctx SpecContext) { createdLimitadorDeployment := appsv1.Deployment{} @@ -220,7 +220,7 @@ var _ = Describe("Limitador controller", func() { Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify the limitador deployment command line args", func(ctx SpecContext) { updatedLimitador := limitadorv1alpha1.Limitador{} @@ -271,7 +271,7 @@ var _ = Describe("Limitador controller", func() { Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify the limitador deployment command line args", func(ctx SpecContext) { Eventually(func(g Gomega) { @@ -325,7 +325,7 @@ var _ = Describe("Limitador controller", func() { Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should create a new deployment with verbosity level command line arg", func(ctx SpecContext) { deployment := &appsv1.Deployment{} @@ -371,7 +371,7 @@ var _ = Describe("Limitador controller", func() { Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify the limitador deployment command line args", func(ctx SpecContext) { deployment := &appsv1.Deployment{} @@ -438,7 +438,7 @@ var _ = Describe("Limitador controller", func() { limitadorObj = basicLimitador(testNamespace) Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("User tries adding side-cars to deployment CR", func(ctx SpecContext) { deploymentObj := appsv1.Deployment{} @@ -507,7 +507,7 @@ var _ = Describe("Limitador controller", func() { Eventually(func(g Gomega) { g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(redisSecret), secret)).To(Succeed()) }).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("command line is correct", func(ctx SpecContext) { limitadorObj := limitadorWithRedisStorage(client.ObjectKeyFromObject(redisSecret), testNamespace) @@ -563,7 +563,7 @@ var _ = Describe("Limitador controller", func() { Eventually(func(g Gomega) { g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(redisSecret), secret)).To(Succeed()) }).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("with all defaults, the command line is correct", func(ctx SpecContext) { limitadorObj := limitadorWithRedisCachedStorage(client.ObjectKeyFromObject(redisSecret), testNamespace) diff --git a/controllers/limitador_controller_version_test.go b/controllers/limitador_controller_version_test.go index 0e4452cc..fb2ddc9f 100644 --- a/controllers/limitador_controller_version_test.go +++ b/controllers/limitador_controller_version_test.go @@ -23,7 +23,7 @@ var _ = Describe("Limitador controller manages image version", func() { BeforeEach(func(ctx SpecContext) { CreateNamespaceWithContext(ctx, &testNamespace) - }, nodeTimeOut) + }) AfterEach(func(ctx SpecContext) { DeleteNamespaceWithContext(ctx, &testNamespace) @@ -37,7 +37,7 @@ var _ = Describe("Limitador controller manages image version", func() { limitadorObj.Spec.Version = ptr.To("otherversion") Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) // Do not expect to have limitador ready - }, nodeTimeOut) + }) It("Should create a new deployment with the custom image", func(ctx SpecContext) { deployment := appsv1.Deployment{} @@ -61,7 +61,7 @@ var _ = Describe("Limitador controller manages image version", func() { Expect(k8sClient.Create(ctx, limitadorObj)).Should(Succeed()) Eventually(testLimitadorIsReady(ctx, limitadorObj)).WithContext(ctx).Should(Succeed()) - }, nodeTimeOut) + }) It("Should modify the deployment with the custom image", func(ctx SpecContext) { deployment := appsv1.Deployment{} diff --git a/controllers/suite_test.go b/controllers/suite_test.go index a985ed77..29f7c77b 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -17,6 +17,7 @@ limitations under the License. package controllers import ( + "encoding/json" "os" "path/filepath" "testing" @@ -25,7 +26,9 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -51,7 +54,18 @@ func TestAPIs(t *testing.T) { RunSpecs(t, "Controller Suite") } -var _ = BeforeSuite(func() { +// SharedConfig contains minimum cluster connection config that can be safely marshalled as rest.Config is unsafe to marshall +type SharedConfig struct { + Host string `json:"host"` + TLSClientConfig struct { + Insecure bool `json:"insecure"` + CertData []uint8 `json:"certData,omitempty"` + KeyData []uint8 `json:"keyData,omitempty"` + CAData []uint8 `json:"caData,omitempty"` + } `json:"tlsClientConfig"` +} + +var _ = SynchronizedBeforeSuite(func() []byte { By("bootstrapping test environment") testEnv = &envtest.Environment{ CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")}, @@ -63,14 +77,7 @@ var _ = BeforeSuite(func() { Expect(err).NotTo(HaveOccurred()) Expect(cfg).NotTo(BeNil()) - err = limitadorv1alpha1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - //+kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) + Expect(limitadorv1alpha1.AddToScheme(scheme.Scheme)).To(Succeed()) mgr, err := ctrl.NewManager(cfg, ctrl.Options{ Scheme: scheme.Scheme, @@ -101,9 +108,56 @@ var _ = BeforeSuite(func() { Expect(err).ToNot(HaveOccurred()) }() + // Create a shared configuration struct to pass Config information to all sub processes + sharedCfg := SharedConfig{ + Host: cfg.Host, + TLSClientConfig: struct { + Insecure bool `json:"insecure"` + CertData []uint8 `json:"certData,omitempty"` + KeyData []uint8 `json:"keyData,omitempty"` + CAData []uint8 `json:"caData,omitempty"` + }{ + Insecure: cfg.TLSClientConfig.Insecure, + CertData: cfg.TLSClientConfig.CertData, + KeyData: cfg.TLSClientConfig.KeyData, + CAData: cfg.TLSClientConfig.CAData, + }, + } + + // Marshal the shared configuration struct + data, err := json.Marshal(sharedCfg) + Expect(err).NotTo(HaveOccurred()) + + return data +}, func(data []byte) { + // Unmarshal the shared configuration struct + var sharedCfg SharedConfig + Expect(json.Unmarshal(data, &sharedCfg)).To(Succeed()) + + // Create the rest.Config object from the shared configuration + cfg := &rest.Config{ + Host: sharedCfg.Host, + TLSClientConfig: rest.TLSClientConfig{ + Insecure: sharedCfg.TLSClientConfig.Insecure, + CertData: sharedCfg.TLSClientConfig.CertData, + KeyData: sharedCfg.TLSClientConfig.KeyData, + CAData: sharedCfg.TLSClientConfig.CAData, + }, + } + + // Create new scheme for each client + s := runtime.NewScheme() + Expect(scheme.AddToScheme(s)).To(Succeed()) + err := limitadorv1alpha1.AddToScheme(s) + Expect(err).NotTo(HaveOccurred()) + + // Set the shared configuration + k8sClient, err = client.New(cfg, client.Options{Scheme: s}) + Expect(err).NotTo(HaveOccurred()) + Expect(k8sClient).NotTo(BeNil()) }) -var _ = AfterSuite(func() { +var _ = SynchronizedAfterSuite(func() {}, func() { By("tearing down the test environment") }) From c7aba29784a3541ec214f8a2b03ceeb9266511c2 Mon Sep 17 00:00:00 2001 From: KevFan Date: Mon, 13 May 2024 17:19:49 +0100 Subject: [PATCH 2/4] refactor: TLSClientConfig struct for SharedConfig --- controllers/suite_test.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 29f7c77b..7ba9b136 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -56,13 +56,15 @@ func TestAPIs(t *testing.T) { // SharedConfig contains minimum cluster connection config that can be safely marshalled as rest.Config is unsafe to marshall type SharedConfig struct { - Host string `json:"host"` - TLSClientConfig struct { - Insecure bool `json:"insecure"` - CertData []uint8 `json:"certData,omitempty"` - KeyData []uint8 `json:"keyData,omitempty"` - CAData []uint8 `json:"caData,omitempty"` - } `json:"tlsClientConfig"` + Host string `json:"host"` + TLSClientConfig TLSClientConfig `json:"tlsClientConfig"` +} + +type TLSClientConfig struct { + Insecure bool `json:"insecure"` + CertData []uint8 `json:"certData,omitempty"` + KeyData []uint8 `json:"keyData,omitempty"` + CAData []uint8 `json:"caData,omitempty"` } var _ = SynchronizedBeforeSuite(func() []byte { @@ -111,12 +113,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { // Create a shared configuration struct to pass Config information to all sub processes sharedCfg := SharedConfig{ Host: cfg.Host, - TLSClientConfig: struct { - Insecure bool `json:"insecure"` - CertData []uint8 `json:"certData,omitempty"` - KeyData []uint8 `json:"keyData,omitempty"` - CAData []uint8 `json:"caData,omitempty"` - }{ + TLSClientConfig: TLSClientConfig{ Insecure: cfg.TLSClientConfig.Insecure, CertData: cfg.TLSClientConfig.CertData, KeyData: cfg.TLSClientConfig.KeyData, From 5a59106568bebef372b8a6d3a7d1be6170c3fe5b Mon Sep 17 00:00:00 2001 From: KevFan Date: Tue, 14 May 2024 16:07:27 +0100 Subject: [PATCH 3/4] refactor: use -p instead of explicit flags for concurrent tests --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c8a9b2a0..7e019e60 100644 --- a/Makefile +++ b/Makefile @@ -91,8 +91,6 @@ IMG ?= $(DEFAULT_IMG) UNIT_DIRS := ./pkg/... ./api/... INTEGRATION_TEST_SUITE_PATHS := ./controllers/... INTEGRATION_COVER_PKGS := ./pkg/...,./controllers/...,./api/... -INTEGRATION_TEST_NUM_CORES ?= 4 -INTEGRATION_TEST_NUM_PROCESSES ?= 10 # Limitador Operator replaced version DEFAULT_REPLACES_VERSION = 0.0.0-alpha @@ -231,8 +229,7 @@ test-integration: clean-cov generate fmt vet ginkgo ## Run Integration tests. --output-dir $(PROJECT_PATH)/coverage/integration \ --coverprofile cover.out \ -v \ - --compilers=$(INTEGRATION_TEST_NUM_CORES) \ - --procs=$(INTEGRATION_TEST_NUM_PROCESSES) \ + -p \ --randomize-all \ --randomize-suites \ --fail-on-pending \ From b57dbfa93acbe94f73c781491b61e450843b2677 Mon Sep 17 00:00:00 2001 From: KevFan Date: Wed, 15 May 2024 09:39:55 +0100 Subject: [PATCH 4/4] Revert "refactor: use -p instead of explicit flags for concurrent tests" This reverts commit 5a59106568bebef372b8a6d3a7d1be6170c3fe5b. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7e019e60..c8a9b2a0 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,8 @@ IMG ?= $(DEFAULT_IMG) UNIT_DIRS := ./pkg/... ./api/... INTEGRATION_TEST_SUITE_PATHS := ./controllers/... INTEGRATION_COVER_PKGS := ./pkg/...,./controllers/...,./api/... +INTEGRATION_TEST_NUM_CORES ?= 4 +INTEGRATION_TEST_NUM_PROCESSES ?= 10 # Limitador Operator replaced version DEFAULT_REPLACES_VERSION = 0.0.0-alpha @@ -229,7 +231,8 @@ test-integration: clean-cov generate fmt vet ginkgo ## Run Integration tests. --output-dir $(PROJECT_PATH)/coverage/integration \ --coverprofile cover.out \ -v \ - -p \ + --compilers=$(INTEGRATION_TEST_NUM_CORES) \ + --procs=$(INTEGRATION_TEST_NUM_PROCESSES) \ --randomize-all \ --randomize-suites \ --fail-on-pending \