Skip to content

Commit

Permalink
tests: Allow parallel execution of DNS and TLS Policy tests
Browse files Browse the repository at this point in the history
Creates a unique gateway class per test case and removes `Ordered` from
the TLS policy tests.

```
./bin/ginkgo -p --procs 20 --focus "DNSPolicy" --focus "TLSPolicy" --skip "Target status reconciler" -tags integration ./controllers/...
```
  • Loading branch information
mikenairn committed Apr 26, 2024
1 parent b3758bd commit 4db8edb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion controllers/dnspolicy_controller_multi_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("DNSPolicy Multi Cluster", func() {
ownerID, err = utils.GetClusterUID(ctx, k8sClient)
Expect(err).To(BeNil())

gatewayClass = testBuildGatewayClass("foo", "default", "kuadrant.io/bar")
gatewayClass = testBuildGatewayClass("gwc-"+testNamespace, "default", "kuadrant.io/bar")
Expect(k8sClient.Create(ctx, gatewayClass)).To(Succeed())

managedZone = testBuildManagedZone("mz-example-com", testNamespace, "example.com")
Expand Down
2 changes: 1 addition & 1 deletion controllers/dnspolicy_controller_single_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var _ = Describe("DNSPolicy Single Cluster", func() {
clusterUID, err := utils.GetClusterUID(ctx, k8sClient)
Expect(err).To(BeNil())

gatewayClass = testBuildGatewayClass("foo", "default", "kuadrant.io/bar")
gatewayClass = testBuildGatewayClass("gwc-"+testNamespace, "default", "kuadrant.io/bar")
Expect(k8sClient.Create(ctx, gatewayClass)).To(Succeed())

managedZone = testBuildManagedZone("mz-example-com", testNamespace, "example.com")
Expand Down
2 changes: 1 addition & 1 deletion controllers/dnspolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _ = Describe("DNSPolicy controller", func() {
ctx = context.Background()
CreateNamespace(&testNamespace)

gatewayClass = testBuildGatewayClass("foo", "default", "kuadrant.io/bar")
gatewayClass = testBuildGatewayClass("gwc-"+testNamespace, "default", "kuadrant.io/bar")
Expect(k8sClient.Create(ctx, gatewayClass)).To(Succeed())

managedZone = testBuildManagedZone("mz-example-com", testNamespace, "example.com")
Expand Down
19 changes: 6 additions & 13 deletions controllers/tlspolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,23 @@ import (
"github.com/kuadrant/kuadrant-operator/api/v1alpha1"
)

var _ = Describe("TLSPolicy controller", Ordered, func() {
var _ = Describe("TLSPolicy controller", func() {

var testNamespace string
var gatewayClass *gatewayapiv1.GatewayClass
var testNamespace string
var issuer *certmanv1.Issuer
var issuerRef *certmanmetav1.ObjectReference
var gateway *gatewayapiv1.Gateway
var tlsPolicy *v1alpha1.TLSPolicy
var ctx context.Context

BeforeAll(func() {
BeforeEach(func() {
ctx = context.Background()
gatewayClass = testBuildGatewayClass("foo", "default", "kuadrant.io/bar")
CreateNamespace(&testNamespace)

gatewayClass = testBuildGatewayClass("gwc-"+testNamespace, "default", "kuadrant.io/bar")
Expect(k8sClient.Create(ctx, gatewayClass)).To(Succeed())
})

BeforeEach(func() {
CreateNamespace(&testNamespace)
issuer, issuerRef = testBuildSelfSignedIssuer("testissuer", testNamespace)
Expect(k8sClient.Create(ctx, issuer)).To(BeNil())
})
Expand All @@ -66,12 +65,6 @@ var _ = Describe("TLSPolicy controller", Ordered, func() {
DeleteNamespaceCallback(&testNamespace)()
})

AfterAll(func() {
err := k8sClient.Delete(ctx, gatewayClass)
Expect(client.IgnoreNotFound(err)).ToNot(HaveOccurred())

})

Context("invalid target", func() {
BeforeEach(func() {
tlsPolicy = v1alpha1.NewTLSPolicy("test-tls-policy", testNamespace).
Expand Down

0 comments on commit 4db8edb

Please sign in to comment.