@@ -114,6 +114,7 @@ func (s *API7Deployer) AfterEach() {
114114 if output != "" {
115115 _ , _ = fmt .Fprintln (GinkgoWriter , output )
116116 }
117+ return
117118 }
118119
119120 // Delete all additional namespaces
@@ -148,6 +149,7 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) {
148149 ForIngressGatewayGroup : true ,
149150 ServiceHTTPPort : 9080 ,
150151 ServiceHTTPSPort : 9443 ,
152+ Replicas : ptr .To (1 ),
151153 }
152154 if deployOpts .Namespace != "" {
153155 opts .Namespace = deployOpts .Namespace
@@ -164,13 +166,22 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) {
164166 if deployOpts .Replicas != nil {
165167 opts .Replicas = deployOpts .Replicas
166168 }
169+ if opts .Replicas != nil && * opts .Replicas == 0 {
170+ deployOpts .SkipCreateTunnels = true
171+ }
167172
168- svc := s .DeployGateway (opts )
173+ for _ , close := range []func (){
174+ s .closeApisixHttpTunnel ,
175+ s .closeApisixHttpsTunnel ,
176+ } {
177+ close ()
178+ }
169179
180+ svc := s .DeployGateway (& opts )
170181 s .dataplaneService = svc
171182
172183 if ! deployOpts .SkipCreateTunnels {
173- err := s .newAPISIXTunnels ()
184+ err := s .newAPISIXTunnels (opts . ServiceName )
174185 Expect (err ).ToNot (HaveOccurred (), "creating apisix tunnels" )
175186 }
176187}
@@ -181,8 +192,7 @@ func (s *API7Deployer) ScaleDataplane(replicas int) {
181192 })
182193}
183194
184- func (s * API7Deployer ) newAPISIXTunnels () error {
185- serviceName := "api7ee3-apisix-gateway-mtls"
195+ func (s * API7Deployer ) newAPISIXTunnels (serviceName string ) error {
186196 httpTunnel , httpsTunnel , err := s .createDataplaneTunnels (s .dataplaneService , s .kubectlOptions , serviceName )
187197 if err != nil {
188198 return err
@@ -247,7 +257,7 @@ func (s *API7Deployer) CreateAdditionalGateway(namePrefix string) (string, *core
247257 serviceName := fmt .Sprintf ("api7ee3-apisix-gateway-%s" , namePrefix )
248258
249259 // Deploy dataplane for this gateway group
250- svc := s .DeployGateway (framework.API7DeployOptions {
260+ svc := s .DeployGateway (& framework.API7DeployOptions {
251261 GatewayGroupID : gatewayGroupID ,
252262 Namespace : additionalNS ,
253263 Name : serviceName ,
0 commit comments