Skip to content

Commit 9010413

Browse files
committed
test: parallel execution of e2e tests
1 parent 02a7753 commit 9010413

File tree

14 files changed

+110
-63
lines changed

14 files changed

+110
-63
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ test: manifests generate fmt vet envtest ## Run tests.
136136
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
137137
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
138138
test-e2e: generate
139-
go test -p 1 ./test/e2e/... -tags=integration -timeout 20m
139+
go test ./test/e2e/... -tags=integration -timeout 20m
140140

141141
# Switch images from `registry.redhat.io` images to the dev images
142142
.PHONY: dev-images

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.24.4
55
toolchain go1.24.6
66

77
require (
8+
github.com/alexflint/go-filemutex v1.3.0
89
github.com/blang/semver/v4 v4.0.0
910
github.com/go-logr/logr v1.4.3
1011
github.com/google/certificate-transparency-go v1.3.2

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/alexflint/go-filemutex v1.3.0 h1:LgE+nTUWnQCyRKbpoceKZsPQbs84LivvgwUymZXdOcM=
2+
github.com/alexflint/go-filemutex v1.3.0/go.mod h1:U0+VA/i30mGBlLCrFPGtTe9y6wGQfNAWPBTekHQ+c8A=
13
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
24
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
35
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -156,6 +158,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
156158
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
157159
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
158160
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
161+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
159162
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
160163
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
161164
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
@@ -199,6 +202,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
199202
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
200203
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
201204
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
205+
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
202206
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
203207
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
204208
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
@@ -230,6 +234,7 @@ gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSP
230234
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
231235
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
232236
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
237+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
233238
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
234239
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
235240
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
File renamed without changes.

test/e2e/byodb_test.go renamed to test/e2e/byo/database_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//go:build integration
22

3-
package e2e
3+
package byo
44

55
import (
66
"context"

test/e2e/provided_certs_test.go renamed to test/e2e/byo/provided_certs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//go:build integration
22

3-
package e2e
3+
package byo
44

55
import (
66
"github.com/securesign/operator/test/e2e/support/steps"

test/e2e/byo/suite_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//go:build integration
2+
3+
package byo
4+
5+
import (
6+
"testing"
7+
"time"
8+
9+
. "github.com/onsi/ginkgo/v2"
10+
. "github.com/onsi/gomega"
11+
"github.com/onsi/gomega/format"
12+
"sigs.k8s.io/controller-runtime/pkg/log"
13+
)
14+
15+
func TestE2e(t *testing.T) {
16+
RegisterFailHandler(Fail)
17+
log.SetLogger(GinkgoLogr)
18+
SetDefaultEventuallyTimeout(time.Duration(3) * time.Minute)
19+
EnforceDefaultTimeoutsWhenUsingContexts()
20+
RunSpecs(t, "Bring your own")
21+
22+
// print whole stack in case of failure
23+
format.MaxLength = 0
24+
}

test/e2e/common_install_test.go renamed to test/e2e/deployment/common_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//go:build integration
22

3-
package e2e
3+
package deployment
44

55
import (
66
"net/http"
@@ -31,7 +31,7 @@ import (
3131
"k8s.io/apimachinery/pkg/types"
3232
)
3333

34-
var _ = Describe("Securesign install with certificate generation", Ordered, func() {
34+
var _ = Describe("Install with generated certs and keys", Ordered, func() {
3535
cli, _ := support.CreateClient()
3636

3737
var targetImageName string

test/e2e/key_autodiscovery_test.go renamed to test/e2e/deployment/key_autodiscovery_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//go:build integration
22

3-
package e2e
3+
package deployment
44

55
import (
66
"github.com/securesign/operator/internal/utils/kubernetes"
@@ -21,7 +21,7 @@ import (
2121
v1 "k8s.io/api/core/v1"
2222
)
2323

24-
var _ = Describe("Securesign key autodiscovery test", Ordered, func() {
24+
var _ = Describe("Install with auto-discovered keys", Ordered, func() {
2525
cli, _ := support.CreateClient()
2626

2727
var targetImageName string

test/e2e/namespaced.go renamed to test/e2e/deployment/namespaced.go

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
//go:build integration
22

3-
package e2e
3+
package deployment
44

55
import (
66
"fmt"
7-
"time"
87

98
. "github.com/onsi/ginkgo/v2"
109
. "github.com/onsi/gomega"
1110
"github.com/securesign/operator/api/v1alpha1"
1211
"github.com/securesign/operator/test/e2e/support"
1312
testSupportKubernetes "github.com/securesign/operator/test/e2e/support/kubernetes"
1413
"github.com/securesign/operator/test/e2e/support/steps"
15-
clients "github.com/securesign/operator/test/e2e/support/tas/cli"
14+
"github.com/securesign/operator/test/e2e/support/tas"
1615
"github.com/securesign/operator/test/e2e/support/tas/ctlog"
1716
"github.com/securesign/operator/test/e2e/support/tas/fulcio"
1817
"github.com/securesign/operator/test/e2e/support/tas/rekor"
@@ -346,38 +345,7 @@ var _ = Describe("Install components to separate namespaces", Ordered, func() {
346345
ts := tsa.Get(ctx, cli, namespaces["tsa"].Name, tsaObject.Name)
347346
Expect(ts).ToNot(BeNil())
348347

349-
Eventually(func() error {
350-
return tsa.GetCertificateChain(ctx, cli, "", "", ts.Status.Url)
351-
}).Should(Succeed())
352-
353-
oidcToken, err := support.OidcToken(ctx)
354-
Expect(err).ToNot(HaveOccurred())
355-
Expect(oidcToken).ToNot(BeEmpty())
356-
357-
// sleep for a while to be sure everything has settled down
358-
time.Sleep(time.Duration(10) * time.Second)
359-
360-
Expect(clients.Execute("cosign", "initialize", "--mirror="+t.Status.Url, "--root="+t.Status.Url+"/root.json")).To(Succeed())
361-
362-
Expect(clients.Execute(
363-
"cosign", "sign", "-y",
364-
"--fulcio-url="+f.Status.Url,
365-
"--rekor-url="+r.Status.Url,
366-
"--timestamp-server-url="+ts.Status.Url+"/api/v1/timestamp",
367-
"--oidc-issuer="+support.OidcIssuerUrl(),
368-
"--oidc-client-id="+support.OidcClientID(),
369-
"--identity-token="+oidcToken,
370-
targetImageName,
371-
)).To(Succeed())
372-
373-
Expect(clients.Execute(
374-
"cosign", "verify",
375-
"--rekor-url="+r.Status.Url,
376-
"--timestamp-certificate-chain=ts_chain.pem",
377-
"--certificate-identity-regexp", ".*@redhat",
378-
"--certificate-oidc-issuer-regexp", ".*keycloak.*",
379-
targetImageName,
380-
)).To(Succeed())
348+
tas.VerifyByCosignCustom(ctx, cli, f, r, t, ts, targetImageName)
381349
})
382350
})
383351
})

0 commit comments

Comments
 (0)