Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 .github/workflows/apisix-conformance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Format Conformance Test Report
if: ${{ github.event_name == 'pull_request' }}
run: |
echo '# conformance test report' > report.md
echo '# conformance test report - ${{ matrix.provider_type }} mode' > report.md
echo '```yaml' >> report.md
cat apisix-ingress-controller-conformance-report.yaml >> report.md
echo '```' >> report.md
5 changes: 5 additions & 0 deletions .github/workflows/apisix-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ jobs:
provider_type:
- apisix-standalone
- apisix
cases_subset:
- apisix.apache.org
- networking.k8s.io
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -106,5 +110,6 @@ jobs:
env:
TEST_DIR: "./test/e2e/apisix/"
PROVIDER_TYPE: ${{ matrix.provider_type }}
TEST_LABEL: ${{ matrix.cases_subset }}
run: |
make e2e-test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ kind-e2e-test: kind-up build-image kind-load-images e2e-test
.PHONY: e2e-test
e2e-test:
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"
go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)" -ginkgo.label-filter="$(TEST_LABEL)"

.PHONY: conformance-test
conformance-test:
Expand Down
31 changes: 0 additions & 31 deletions config/rbac/gatewayproxy_editor_role.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions config/rbac/gatewayproxy_viewer_role.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions internal/provider/adc/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ func (e *DefaultADCExecutor) buildCmdError(runErr error, stdout, stderr []byte)

func (e *DefaultADCExecutor) handleOutput(output []byte) error {
var result adctypes.SyncResult
if index := strings.IndexByte(string(output), '{'); index > 0 {
log.Warnf("extra output: %s", string(output[:index]))
output = output[index:]
log.Debugf("adc output: %s", string(output))
if lines := bytes.Split(output, []byte{'\n'}); len(lines) > 0 {
output = lines[len(lines)-1]
Comment thread
ronething marked this conversation as resolved.
}
if err := json.Unmarshal(output, &result); err != nil {
log.Errorw("failed to unmarshal adc output",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apisix/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("APISIX Standalone Basic Tests", func() {
var _ = Describe("APISIX Standalone Basic Tests", Label("apisix.apache.org", "v2", "basic"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apisix/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

type Headers map[string]string

var _ = Describe("Test ApisixConsumer", func() {
var _ = Describe("Test ApisixConsumer", Label("apisix.apache.org", "v2", "apisixconsumer"), func() {
var (
s = scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apisix/globalrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
scope: "Namespace"
`

var _ = Describe("Test GlobalRule", func() {
var _ = Describe("Test GlobalRule", Label("apisix.apache.org", "v2", "apisixglobalrule"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apisix/pluginconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
scope: "Namespace"
`

var _ = Describe("Test ApisixPluginConfig", func() {
var _ = Describe("Test ApisixPluginConfig", Label("apisix.apache.org", "v2", "apisixpluginconfig"), func() {
var (
s = scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apisix/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test ApisixRoute", func() {
var _ = Describe("Test ApisixRoute", Label("apisix.apache.org", "v2", "apisixroute"), func() {
var (
s = scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apisix/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var Cert = strings.TrimSpace(framework.TestServerCert)

var Key = strings.TrimSpace(framework.TestServerKey)

var _ = Describe("Test ApisixTls", func() {
var _ = Describe("Test ApisixTls", Label("apisix.apache.org", "v2", "apisixtls"), func() {
var (
s = scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/crds/backendtrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test BackendTrafficPolicy base on HTTPRoute", func() {
var _ = Describe("Test BackendTrafficPolicy base on HTTPRoute", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() {
s := scaffold.NewDefaultScaffold()

var defaultGatewayProxy = `
Expand Down Expand Up @@ -161,7 +161,7 @@ spec:
})
})

var _ = Describe("Test BackendTrafficPolicy base on Ingress", func() {
var _ = Describe("Test BackendTrafficPolicy base on Ingress", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/crds/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test Consumer", func() {
var _ = Describe("Test Consumer", Label("apisix.apache.org", "v1alpha1", "consumer"), func() {
s := scaffold.NewDefaultScaffold()

var defaultGatewayProxy = `
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gatewayapi/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Check if controller cache gets synced with correct resources", func() {
var _ = Describe("Check if controller cache gets synced with correct resources", Label("networking.k8s.io", "basic"), func() {

var gatewayProxyYaml = `
apiVersion: apisix.apache.org/v1alpha1
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gatewayapi/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func createSecret(s *scaffold.Scaffold, secretName string) {
assert.Nil(GinkgoT(), err, "create secret error")
}

var _ = Describe("Test Gateway", func() {
var _ = Describe("Test Gateway", Label("networking.k8s.io", "gateway"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
})
Expand Down
131 changes: 131 additions & 0 deletions test/e2e/gatewayapi/gatewayclass.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package gatewayapi

import (
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test GatewayClass", Label("networking.k8s.io", "gatewayclass"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
})

Context("Create GatewayClass", func() {
var defautlGatewayClass = `
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: apisix
spec:
controllerName: "apisix.apache.org/apisix-ingress-controller"
`

var noGatewayClass = `
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: apisix-not-accepeted
spec:
controllerName: "apisix.apache.org/not-exist"
`
const defaultGateway = `
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: apisix
spec:
gatewayClassName: apisix
listeners:
- name: http1
protocol: HTTP
port: 80
`
It("Create GatewayClass", func() {
By("create default GatewayClass")
err := s.CreateResourceFromStringWithNamespace(defautlGatewayClass, "")
Expect(err).NotTo(HaveOccurred(), "creating GatewayClass")
time.Sleep(5 * time.Second)

gcyaml, err := s.GetResourceYaml("GatewayClass", "apisix")
Expect(err).NotTo(HaveOccurred(), "getting GatewayClass yaml")
Expect(gcyaml).To(ContainSubstring(`status: "True"`), "checking GatewayClass condition status")
Expect(gcyaml).To(ContainSubstring("message: the gatewayclass has been accepted by the apisix-ingress-controller"), "checking GatewayClass condition message")

By("create GatewayClass with not accepted")
err = s.CreateResourceFromStringWithNamespace(noGatewayClass, "")
Expect(err).NotTo(HaveOccurred(), "creating GatewayClass")
time.Sleep(5 * time.Second)

gcyaml, err = s.GetResourceYaml("GatewayClass", "apisix-not-accepeted")
Expect(err).NotTo(HaveOccurred(), "getting GatewayClass yaml")
Expect(gcyaml).To(ContainSubstring(`status: Unknown`), "checking GatewayClass condition status")
Expect(gcyaml).To(ContainSubstring("message: Waiting for controller"), "checking GatewayClass condition message")
})

It("Delete GatewayClass", func() {
By("create default GatewayClass")
err := s.CreateResourceFromStringWithNamespace(defautlGatewayClass, "")
Expect(err).NotTo(HaveOccurred(), "creating GatewayClass")
Eventually(func() string {
spec, err := s.GetResourceYaml("GatewayClass", "apisix")
Expect(err).NotTo(HaveOccurred(), "get resource yaml")
return spec
}).WithTimeout(8 * time.Second).ProbeEvery(time.Second).Should(ContainSubstring(`status: "True"`))

By("create a Gateway")
err = s.CreateResourceFromStringWithNamespace(defaultGateway, s.Namespace())
Expect(err).NotTo(HaveOccurred(), "creating Gateway")
time.Sleep(time.Second)

By("try to delete the GatewayClass")
_, err = s.RunKubectlAndGetOutput("delete", "GatewayClass", "apisix", "--wait=false")
Expect(err).NotTo(HaveOccurred())

_, err = s.GetResourceYaml("GatewayClass", "apisix")
Expect(err).NotTo(HaveOccurred(), "get resource yaml")

output, err := s.RunKubectlAndGetOutput("describe", "GatewayClass", "apisix")
Expect(err).NotTo(HaveOccurred(), "describe GatewayClass apisix")
Expect(output).To(And(
ContainSubstring("Warning"),
ContainSubstring("DeletionBlocked"),
ContainSubstring("gatewayclass-controller"),
ContainSubstring("the GatewayClass is still used by Gateways"),
))

By("delete the Gateway")
err = s.DeleteResource("Gateway", "apisix")
Expect(err).NotTo(HaveOccurred(), "deleting Gateway")
time.Sleep(time.Second)

By("try to delete the GatewayClass again")
err = s.DeleteResource("GatewayClass", "apisix")
Expect(err).NotTo(HaveOccurred())

_, err = s.GetResourceYaml("GatewayClass", "apisix")
Expect(err).To(HaveOccurred(), "get resource yaml")
Expect(err.Error()).To(ContainSubstring("not found"))
})
})
})
2 changes: 1 addition & 1 deletion test/e2e/gatewayapi/gatewayproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test GatewayProxy", func() {
var _ = Describe("Test GatewayProxy", Label("apisix.apache.org", "v1alpha1", "gatewayproxy"), func() {
s := scaffold.NewDefaultScaffold()

var defaultGatewayClass = `
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gatewayapi/httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

var _ = Describe("Test HTTPRoute", func() {
var _ = Describe("Test HTTPRoute", Label("networking.k8s.io", "httproute"), func() {
s := scaffold.NewDefaultScaffold()

var gatewayProxyYaml = `
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func createSecret(s *scaffold.Scaffold, secretName string) {
assert.Nil(GinkgoT(), err, "create secret error")
}

var _ = Describe("Test Ingress", func() {
var _ = Describe("Test Ingress", Label("networking.k8s.io", "ingress"), func() {
s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
})
Expand Down
Loading