Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/conformance/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/crds/v1alpha1/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/crds/v1alpha1/gatewayproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down Expand Up @@ -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")
}

Expand Down
5 changes: 1 addition & 4 deletions test/e2e/crds/v2/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/api7_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/gatewayapi/httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand All @@ -1988,6 +1985,7 @@ spec:
s.Deployer.ScaleDataplane(0)
s.Deployer.ScaleDataplane(1)
s.Deployer.ScaleIngress(1)
time.Sleep(10 * time.Second)

s.RequestAssert(&scaffold.RequestAssert{
Method: "GET",
Expand Down
20 changes: 15 additions & 5 deletions test/e2e/scaffold/api7_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (s *API7Deployer) AfterEach() {
if output != "" {
_, _ = fmt.Fprintln(GinkgoWriter, output)
}
return
}

// Delete all additional namespaces
Expand Down Expand Up @@ -148,6 +149,7 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) {
ForIngressGatewayGroup: true,
ServiceHTTPPort: 9080,
ServiceHTTPSPort: 9443,
Replicas: ptr.To(1),
}
if deployOpts.Namespace != "" {
opts.Namespace = deployOpts.Namespace
Expand All @@ -164,13 +166,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")
}
}
Expand All @@ -181,8 +192,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
Expand Down Expand Up @@ -247,7 +257,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,
Expand Down
Loading