Skip to content

Commit ff98381

Browse files
Merge pull request #4891 from jupdec/eks-auto-tests-v2
refactor: making tests configurable to run on eks auto framework
2 parents 52ebc1c + 84e31c0 commit ff98381

20 files changed

Lines changed: 149 additions & 57 deletions

test/e2e/gateway/alb_tests/alb_gateway_suite_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,15 @@ package alb_tests
33
import (
44
"testing"
55

6-
"sigs.k8s.io/aws-load-balancer-controller/v3/test/framework"
7-
86
. "github.com/onsi/ginkgo/v2"
97
. "github.com/onsi/gomega"
108
)
119

12-
var tf *framework.Framework
13-
1410
func TestALBGateway(t *testing.T) {
1511
RegisterFailHandler(Fail)
1612
RunSpecs(t, "ALB Gateway Suite")
1713
}
1814

1915
var _ = BeforeSuite(func() {
20-
var err error
21-
tf, err = framework.InitFramework()
22-
Expect(err).NotTo(HaveOccurred())
16+
Expect(InitTF()).To(Succeed())
2317
})

test/e2e/gateway/alb_tests/alb_instance_target_test.go renamed to test/e2e/gateway/alb_tests/alb_instance_target.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,4 +2083,4 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
20832083
})
20842084
})
20852085
})
2086-
})
2086+
})

test/e2e/gateway/alb_tests/alb_ip_target_test.go renamed to test/e2e/gateway/alb_tests/alb_ip_target.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,4 +2499,4 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
24992499
})
25002500
})
25012501
})
2502-
})
2502+
})

test/e2e/gateway/alb_tests/alb_test_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (s *ALBTestStack) DeployHTTPWithDefaultTGC(ctx context.Context, f *framewor
131131
}
132132

133133
func (s *ALBTestStack) deploy(ctx context.Context, f *framework.Framework, gwListeners []gwv1.Listener, httprs []*gwv1.HTTPRoute, grpcrs []*gwv1.GRPCRoute, dps []*appsv1.Deployment, svcs []*corev1.Service, lbConfSpec elbv2gw.LoadBalancerConfigurationSpec, tgcs []*elbv2gw.TargetGroupConfiguration, lrConfSpec elbv2gw.ListenerRuleConfigurationSpec, secret *testOIDCSecret, readinessGateEnabled bool) error {
134-
gwc := test_resources.BuildGatewayClassSpec("gateway.k8s.aws/alb")
134+
gwc := test_resources.BuildGatewayClassSpec(test_resources.ALBGatewayControllerName)
135135
gw := test_resources.BuildBasicGatewaySpec(gwc, gwListeners)
136136
lbc := test_resources.BuildLoadBalancerConfig(f, lbConfSpec)
137137
lrc := test_resources.BuildListenerRuleConfig(test_resources.DefaultLRConfigName, lrConfSpec)

test/e2e/gateway/alb_tests/alb_trust_store_test.go renamed to test/e2e/gateway/alb_tests/alb_trust_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,4 +358,4 @@ var _ = Describe("test ALB Gateway with Trust Store for mTLS", func() {
358358
})
359359
})
360360
})
361-
})
361+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package alb_tests
2+
3+
import "sigs.k8s.io/aws-load-balancer-controller/v3/test/framework"
4+
5+
var tf *framework.Framework
6+
7+
// InitTF initializes the package-level framework. Idempotent so a parent test binary
8+
// that blank-imports multiple gateway e2e packages can call it once per package from a
9+
// consolidated BeforeSuite without racing framework state.
10+
func InitTF() error {
11+
if tf != nil {
12+
return nil
13+
}
14+
var err error
15+
tf, err = framework.InitFramework()
16+
return err
17+
}

test/e2e/gateway/chained_gateway_tests/alb_nlb_test.go renamed to test/e2e/gateway/chained_gateway_tests/alb_nlb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,4 @@ var _ = Describe("test combined ALB and NLB gateways with HTTPRoute and TCPRoute
275275
})
276276
})
277277
})
278-
})
278+
})

test/e2e/gateway/chained_gateway_tests/chained_gateway_suite_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ package chained_gateway_tests
33
import (
44
"testing"
55

6-
"sigs.k8s.io/aws-load-balancer-controller/v3/test/framework"
7-
86
. "github.com/onsi/ginkgo/v2"
97
. "github.com/onsi/gomega"
8+
"sigs.k8s.io/aws-load-balancer-controller/v3/test/e2e/gateway/alb_tests"
9+
"sigs.k8s.io/aws-load-balancer-controller/v3/test/e2e/gateway/nlb_tests"
1010
)
1111

12-
var tf *framework.Framework
13-
1412
func TestChainedGateway(t *testing.T) {
1513
RegisterFailHandler(Fail)
1614
RunSpecs(t, "Chained Gateway Suite")
1715
}
1816

1917
var _ = BeforeSuite(func() {
20-
var err error
21-
tf, err = framework.InitFramework()
22-
Expect(err).NotTo(HaveOccurred())
18+
Expect(InitTF()).To(Succeed())
19+
// Init imported packages' tf; their Describes are transitively registered here.
20+
Expect(alb_tests.InitTF()).To(Succeed())
21+
Expect(nlb_tests.InitTF()).To(Succeed())
2322
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package chained_gateway_tests
2+
3+
import "sigs.k8s.io/aws-load-balancer-controller/v3/test/framework"
4+
5+
var tf *framework.Framework
6+
7+
// InitTF initializes the package-level framework. Idempotent so a parent test binary
8+
// that blank-imports multiple gateway e2e packages can call it once per package from a
9+
// consolidated BeforeSuite without racing framework state.
10+
func InitTF() error {
11+
if tf != nil {
12+
return nil
13+
}
14+
var err error
15+
tf, err = framework.InitFramework()
16+
return err
17+
}

test/e2e/gateway/listenerset_tests/gateway_listenerset_suite_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,15 @@ package listenerset_tests
33
import (
44
"testing"
55

6-
"sigs.k8s.io/aws-load-balancer-controller/v3/test/framework"
7-
86
. "github.com/onsi/ginkgo/v2"
97
. "github.com/onsi/gomega"
108
)
119

12-
var tf *framework.Framework
13-
1410
func TestGatewayListenerSet(t *testing.T) {
1511
RegisterFailHandler(Fail)
1612
RunSpecs(t, "ListenerSet Gateway Suite")
1713
}
1814

1915
var _ = BeforeSuite(func() {
20-
var err error
21-
tf, err = framework.InitFramework()
22-
Expect(err).NotTo(HaveOccurred())
16+
Expect(InitTF()).To(Succeed())
2317
})

0 commit comments

Comments
 (0)