diff --git a/test/conformance/suite_test.go b/test/conformance/suite_test.go index 59649c3b2..89c87c236 100644 --- a/test/conformance/suite_test.go +++ b/test/conformance/suite_test.go @@ -139,7 +139,7 @@ func TestMain(m *testing.M) { gatewayGroupId := f.CreateNewGatewayGroupWithIngress() adminKey := f.GetAdminKey(gatewayGroupId) - svc := f.DeployGateway(framework.API7DeployOptions{ + svc := f.DeployGateway(&framework.API7DeployOptions{ Namespace: namespace, GatewayGroupID: gatewayGroupId, DPManagerEndpoint: framework.DPManagerTLSEndpoint, diff --git a/test/e2e/crds/v1alpha1/consumer.go b/test/e2e/crds/v1alpha1/consumer.go index bb8f92d39..daa092cd7 100644 --- a/test/e2e/crds/v1alpha1/consumer.go +++ b/test/e2e/crds/v1alpha1/consumer.go @@ -23,7 +23,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/apache/apisix-ingress-controller/internal/provider/adc" "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) @@ -616,9 +615,6 @@ spec: }) It("Should sync Consumer during startup", func() { - if s.Deployer.Name() == adc.BackendModeAPI7EE { - Skip("don't need to run on api7ee mode") - } Expect(s.CreateResourceFromString(consumer2)).NotTo(HaveOccurred(), "creating unused consumer") s.ResourceApplied("Consumer", "consumer-sample", consumer1, 1) diff --git a/test/e2e/crds/v1alpha1/gatewayproxy.go b/test/e2e/crds/v1alpha1/gatewayproxy.go index 2c582dd20..8a934150d 100644 --- a/test/e2e/crds/v1alpha1/gatewayproxy.go +++ b/test/e2e/crds/v1alpha1/gatewayproxy.go @@ -133,7 +133,7 @@ spec: ` BeforeEach(func() { By("create GatewayProxy") - if s.Deployer.Name() == "api7ee" { + if s.Deployer.Name() == adc.BackendModeAPI7EE { err = s.CreateResourceFromString(fmt.Sprintf(gatewayProxySpecAPI7, s.Deployer.GetAdminEndpoint(), s.AdminKey())) } else { err = s.CreateResourceFromString(fmt.Sprintf(gatewayProxySpec, framework.ProviderType, s.AdminKey())) @@ -162,7 +162,7 @@ spec: Context("Test GatewayProxy update configs", func() { It("scaling apisix pods to test that the controller watches endpoints", func() { - if s.Deployer.Name() == "api7ee" { + if s.Deployer.Name() == adc.BackendModeAPI7EE { Skip("this case only for apisix/apisix-standalone mode") } diff --git a/test/e2e/crds/v2/route.go b/test/e2e/crds/v2/route.go index 0eefa518e..a35f25627 100644 --- a/test/e2e/crds/v2/route.go +++ b/test/e2e/crds/v2/route.go @@ -224,7 +224,7 @@ spec: }) It("Test ApisixRoute filterFunc", func() { - if s.Deployer.Name() == "api7ee" { + if s.Deployer.Name() == adc.BackendModeAPI7EE { Skip("filterFunc is not supported in api7ee") } const apisixRouteSpec = ` @@ -711,9 +711,6 @@ spec: servicePort: 80 ` It("Should sync ApisixRoute during startup", func() { - if s.Deployer.Name() == adc.BackendModeAPI7EE { - Skip("don't need to run on api7ee mode") - } By("apply ApisixRoute") Expect(s.CreateResourceFromString(route2)).ShouldNot(HaveOccurred(), "apply ApisixRoute with nonexistent ingressClassName") Expect(s.CreateResourceFromString(route3)).ShouldNot(HaveOccurred(), "apply ApisixRoute without ingressClassName") diff --git a/test/e2e/framework/api7_gateway.go b/test/e2e/framework/api7_gateway.go index 34c31fae4..4149d46ca 100644 --- a/test/e2e/framework/api7_gateway.go +++ b/test/e2e/framework/api7_gateway.go @@ -62,7 +62,7 @@ type API7DeployOptions struct { Replicas *int } -func (f *Framework) DeployGateway(opts API7DeployOptions) *corev1.Service { +func (f *Framework) DeployGateway(opts *API7DeployOptions) *corev1.Service { if opts.ServiceName == "" { opts.ServiceName = "api7ee3-apisix-gateway-mtls" } diff --git a/test/e2e/gatewayapi/httproute.go b/test/e2e/gatewayapi/httproute.go index 42f06844b..fec9a4312 100644 --- a/test/e2e/gatewayapi/httproute.go +++ b/test/e2e/gatewayapi/httproute.go @@ -75,7 +75,7 @@ spec: value: "%s" ` getGatewayProxySpec := func() string { - if s.Deployer.Name() == "api7ee" { + if s.Deployer.Name() == adc.BackendModeAPI7EE { return fmt.Sprintf(gatewayProxyYamlAPI7, s.Deployer.GetAdminEndpoint(), s.AdminKey()) } return fmt.Sprintf(gatewayProxyYaml, framework.ProviderType, s.AdminKey()) @@ -1963,9 +1963,6 @@ spec: port: 80 ` It("Should sync ApisixRoute during startup", func() { - if s.Deployer.Name() == adc.BackendModeAPI7EE { - Skip("don't need to run on api7ee mode") - } By("apply ApisixRoute") Expect(s.CreateResourceFromString(route2)).ShouldNot(HaveOccurred(), "applying HTTPRoute with non-existent parent") s.ResourceApplied("HTTPRoute", "httpbin", route, 1) diff --git a/test/e2e/scaffold/api7_deployer.go b/test/e2e/scaffold/api7_deployer.go index d4846bf7e..4646d9429 100644 --- a/test/e2e/scaffold/api7_deployer.go +++ b/test/e2e/scaffold/api7_deployer.go @@ -148,6 +148,7 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) { ForIngressGatewayGroup: true, ServiceHTTPPort: 9080, ServiceHTTPSPort: 9443, + Replicas: ptr.To(1), } if deployOpts.Namespace != "" { opts.Namespace = deployOpts.Namespace @@ -164,13 +165,22 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) { if deployOpts.Replicas != nil { opts.Replicas = deployOpts.Replicas } + if opts.Replicas != nil && *opts.Replicas == 0 { + deployOpts.SkipCreateTunnels = true + } - svc := s.DeployGateway(opts) + for _, close := range []func(){ + s.closeApisixHttpTunnel, + s.closeApisixHttpsTunnel, + } { + close() + } + svc := s.DeployGateway(&opts) s.dataplaneService = svc if !deployOpts.SkipCreateTunnels { - err := s.newAPISIXTunnels() + err := s.newAPISIXTunnels(opts.ServiceName) Expect(err).ToNot(HaveOccurred(), "creating apisix tunnels") } } @@ -181,8 +191,7 @@ func (s *API7Deployer) ScaleDataplane(replicas int) { }) } -func (s *API7Deployer) newAPISIXTunnels() error { - serviceName := "api7ee3-apisix-gateway-mtls" +func (s *API7Deployer) newAPISIXTunnels(serviceName string) error { httpTunnel, httpsTunnel, err := s.createDataplaneTunnels(s.dataplaneService, s.kubectlOptions, serviceName) if err != nil { return err @@ -247,7 +256,7 @@ func (s *API7Deployer) CreateAdditionalGateway(namePrefix string) (string, *core serviceName := fmt.Sprintf("api7ee3-apisix-gateway-%s", namePrefix) // Deploy dataplane for this gateway group - svc := s.DeployGateway(framework.API7DeployOptions{ + svc := s.DeployGateway(&framework.API7DeployOptions{ GatewayGroupID: gatewayGroupID, Namespace: additionalNS, Name: serviceName,