Skip to content

Commit 76dfb6b

Browse files
committed
Run test in parallel
1 parent d4419fe commit 76dfb6b

File tree

9 files changed

+25
-39
lines changed

9 files changed

+25
-39
lines changed

scripts/ci_e2e_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ test_controller_image() {
212212
CERTIFICATE_ARNS=${CERTIFICATE_ARNS:-"${CERTIFICATE_ARN_PREFIX}/${CERT_ID1},${CERTIFICATE_ARN_PREFIX}/${CERT_ID2},${CERTIFICATE_ARN_PREFIX}/${CERT_ID3}"}
213213
echo "creating s3 bucket $S3_BUCKET"
214214
aws s3api create-bucket --bucket $S3_BUCKET --region $AWS_REGION --create-bucket-configuration LocationConstraint=$AWS_REGION || true
215-
ginkgo -timeout 3h -v -r test/e2e -- \
215+
ginkgo -timeout 3h -v -p -r test/e2e -- \
216216
--kubeconfig=${CLUSTER_KUBECONFIG} \
217217
--cluster-name=${CLUSTER_NAME} \
218218
--aws-region=${AWS_REGION} \

test/e2e/gateway/alb_resource_stack.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ func (s *albResourceStack) Deploy(ctx context.Context, f *framework.Framework) e
6666
}
6767

6868
func (s *albResourceStack) Cleanup(ctx context.Context, f *framework.Framework) error {
69+
if s == nil || s.commonStack == nil {
70+
return nil
71+
}
6972
if err := s.commonStack.Cleanup(ctx, f); err != nil {
7073
return err
7174
}

test/e2e/gateway/alb_test_helper.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ func (s *ALBTestStack) deploy(ctx context.Context, f *framework.Framework, gwLis
7474
}
7575

7676
func (s *ALBTestStack) Cleanup(ctx context.Context, f *framework.Framework) error {
77+
if s.albResourceStack == nil {
78+
return nil
79+
}
7780
return s.albResourceStack.Cleanup(ctx, f)
7881
}
7982

test/e2e/gateway/nlb_resource_stack.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ func (s *nlbResourceStack) Deploy(ctx context.Context, f *framework.Framework) e
6060
}
6161

6262
func (s *nlbResourceStack) Cleanup(ctx context.Context, f *framework.Framework) error {
63+
if s == nil || s.commonStack == nil {
64+
return nil
65+
}
6366
return s.commonStack.Cleanup(ctx, f)
6467
}
6568

test/e2e/gateway/nlb_test_helper.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ func (s *NLBTestStack) CreateFENLBReferenceGrant(ctx context.Context, f *framewo
317317
}
318318

319319
func (s *NLBTestStack) Cleanup(ctx context.Context, f *framework.Framework) error {
320+
if s.nlbResourceStack == nil {
321+
return nil
322+
}
320323
return s.nlbResourceStack.Cleanup(ctx, f)
321324
}
322325

test/e2e/ingress/ingress_suite_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
. "github.com/onsi/gomega"
66
framework "sigs.k8s.io/aws-load-balancer-controller/test/framework"
77
"testing"
8+
"time"
89
)
910

1011
var tf *framework.Framework
@@ -14,10 +15,19 @@ func TestIngress(t *testing.T) {
1415
RunSpecs(t, "Ingress Suite")
1516
}
1617

17-
var _ = BeforeSuite(func() {
18+
var _ = SynchronizedBeforeSuite(func() []byte {
1819
var err error
19-
2020
tf, err = framework.InitFramework()
21+
Expect(err).NotTo(HaveOccurred())
2122

23+
if tf.Options.ControllerImage != "" {
24+
err = tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, true, true)
25+
Expect(err).NotTo(HaveOccurred())
26+
time.Sleep(60 * time.Second)
27+
}
28+
return nil
29+
}, func(data []byte) {
30+
var err error
31+
tf, err = framework.InitFramework()
2232
Expect(err).NotTo(HaveOccurred())
2333
})

test/e2e/ingress/multi_path_backend_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ var _ = Describe("test ingresses with multiple path and backends", func() {
2121

2222
BeforeEach(func() {
2323
ctx = context.Background()
24-
25-
if tf.Options.ControllerImage != "" {
26-
By(fmt.Sprintf("ensure cluster installed with controller: %s", tf.Options.ControllerImage), func() {
27-
err := tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, false, false)
28-
Expect(err).NotTo(HaveOccurred())
29-
time.Sleep(60 * time.Second)
30-
})
31-
}
3224
})
3325

3426
AfterEach(func() {

test/e2e/ingress/target_control_port_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"net/http"
77
"strings"
8-
"time"
98

109
awssdk "github.com/aws/aws-sdk-go-v2/aws"
1110
"github.com/gavv/httpexpect/v2"
@@ -40,16 +39,6 @@ var _ = Describe("ALB target control agent injection and target control port tes
4039

4140
BeforeEach(func() {
4241
ctx = context.Background()
43-
if tf.Options.ControllerImage != "" {
44-
By("upgrade controller with ALBTargetControlAgent enabled", func() {
45-
tf.Logger.Info("Starting controller upgrade", "image", tf.Options.ControllerImage)
46-
err := tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, false, true)
47-
Expect(err).NotTo(HaveOccurred())
48-
tf.Logger.Info("Controller upgrade completed, waiting for rollout")
49-
time.Sleep(60 * time.Second)
50-
tf.Logger.Info("Controller should be ready now")
51-
})
52-
}
5342
By("setup sandbox namespace", func() {
5443
tf.Logger.Info("allocating namespace")
5544
ns, err := tf.NSManager.AllocateNamespace(ctx, "alb-target-control-e2e")

test/e2e/ingress/vanilla_ingress_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ var _ = Describe("vanilla ingress tests", func() {
4040

4141
BeforeEach(func() {
4242
ctx = context.Background()
43-
if tf.Options.ControllerImage != "" {
44-
By(fmt.Sprintf("ensure cluster installed with controller: %s", tf.Options.ControllerImage), func() {
45-
err := tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, false, false)
46-
Expect(err).NotTo(HaveOccurred())
47-
time.Sleep(60 * time.Second)
48-
})
49-
}
5043

5144
By("setup sandbox namespace", func() {
5245
tf.Logger.Info("allocating namespace")
@@ -434,16 +427,6 @@ var _ = Describe("vanilla ingress tests", func() {
434427
})
435428

436429
Context("with ALB IP targets, named target port and endPointSlices enabled", func() {
437-
BeforeEach(func() {
438-
ctx = context.Background()
439-
if tf.Options.ControllerImage != "" {
440-
By(fmt.Sprintf("upgrade controller with endPointSlices enabled."), func() {
441-
err := tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, true, false)
442-
Expect(err).NotTo(HaveOccurred())
443-
time.Sleep(60 * time.Second)
444-
})
445-
}
446-
})
447430
It("with 'alb.ingress.kubernetes.io/target-type' annotation explicitly specified, and endPointSlices enabled, one ALB shall be created and functional", func() {
448431
appBuilder := manifest.NewFixedResponseServiceBuilder().WithTargetPortName("e2e-targetport")
449432
ingBuilder := manifest.NewIngressBuilder()

0 commit comments

Comments
 (0)