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
3 changes: 1 addition & 2 deletions .github/workflows/e2e-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ concurrency:

jobs:
changes:
if: |
contains(github.event.pull_request.labels.*.name, 'ci-e2e-test')
if: contains(github.event.pull_request.labels.*.name, 'ci-e2e-test')
runs-on: buildjet-2vcpu-ubuntu-2204
outputs:
docs: ${{ steps.filter.outputs.docs }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/unit-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ on:
- release/1.8
jobs:
changes:
if: |
contains(github.event.pull_request.labels.*.name, 'ci-unit-test')
if: contains(github.event.pull_request.labels.*.name, 'ci-unit-test')
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
Expand Down
23 changes: 23 additions & 0 deletions test/e2e/scaffold/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"time"

"github.com/api7/api7-ingress-controller/pkg/apisix"
v2 "github.com/api7/api7-ingress-controller/pkg/kube/apisix/apis/config/v2"
"github.com/api7/api7-ingress-controller/pkg/log"
"github.com/api7/api7-ingress-controller/pkg/metrics"
v1 "github.com/api7/api7-ingress-controller/pkg/types/apisix/v1"
Expand Down Expand Up @@ -820,3 +821,25 @@ func (s *Scaffold) RunDigDNSClientFromK8s(args ...string) (string, error) {
kubectlArgs = append(kubectlArgs, args...)
return s.RunKubectlAndGetOutput(kubectlArgs...)
}

func (s *Scaffold) GetApisixResourceStatus(resourceName string, resourceType string) (*v2.ApisixStatus, error) {
kubectlArgs := []string{
"get", resourceType, resourceName, "-o", "json",
}
output, err := s.RunKubectlAndGetOutput(kubectlArgs...)
if err != nil {
return nil, err
}
var upstream v2.ApisixUpstream
err = json.Unmarshal([]byte(output), &upstream)
if err != nil {
return nil, err
}
return &upstream.Status, nil
}

func (s *Scaffold) AssertCRSync(resourceName, resourceType, message string) {
routeStatus, err := s.GetApisixResourceStatus(resourceName, resourceType)
assert.Nil(ginkgo.GinkgoT(), err)
assert.Equal(ginkgo.GinkgoT(), message, routeStatus.Conditions[0].Message)
}
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: authorization annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: authorization annotations", func() {
suites := func(scaffoldFunc func() *scaffold.Scaffold) {
s := scaffoldFunc()

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: cors annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: cors annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: csrf annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: csrf annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable csrf in ingress networking/v1", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/forward_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: froward-auth annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: froward-auth annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.JustBeforeEach(func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/http_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: allow-http-methods annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: allow-http-methods annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down Expand Up @@ -101,7 +101,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: blocklist-http-methods annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: blocklist-http-methods annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/iprestriction.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: allowlist-source-range annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: allowlist-source-range annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down Expand Up @@ -89,7 +89,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: blocklist-source-range annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: blocklist-source-range annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/plugin_conifg.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func _assert(s *scaffold.Scaffold, ing string) {
resp.Body().Contains("This is the epilogue")
}

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 with ApisixPluginConfig", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 with ApisixPluginConfig", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("networking/v1", func() {
backendSvc, backendPorts := s.DefaultHTTPBackend()
Expand Down Expand Up @@ -106,7 +106,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1beta1 with ApisixPluginConfig", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1beta1 with ApisixPluginConfig", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("networking/v1beta1", func() {
_createAPC(s)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: redirect annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: redirect annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("redirect http-to-https in ingress networking/v1", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/response_rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

// suite-annotations: response-rewrite annotations
var _ = ginkgo.Describe("suite-annotations: response-rewrite", func() {
var _ = ginkgo.PDescribe("suite-annotations: response-rewrite", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: rewrite annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: rewrite annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down Expand Up @@ -89,7 +89,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: rewrite regex annotations", func() {
var _ = ginkgo.PDescribe("suite-annotations: rewrite regex annotations", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("enable in ingress networking/v1", func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/svc_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: svc-namespace annotations reference service in the same namespace", func() {
var _ = ginkgo.PDescribe("suite-annotations: svc-namespace annotations reference service in the same namespace", func() {
s := scaffold.NewDefaultScaffold()

ginkgo.It("networking/v1", func() {
Expand Down Expand Up @@ -108,7 +108,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: svc-namespace annotations cross-namespace reference service", func() {
var _ = ginkgo.PDescribe("suite-annotations: svc-namespace annotations cross-namespace reference service", func() {
s := scaffold.NewDefaultScaffold()

createNamespace := func(namespace string, watch string) {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/suite-annotations/upstreamprotocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 upstream scheme", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 upstream scheme", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("sanity", func() {
ing := `
Expand Down Expand Up @@ -59,7 +59,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations-error: annotations.networking/v1 upstream scheme error", func() {
var _ = ginkgo.PDescribe("suite-annotations-error: annotations.networking/v1 upstream scheme error", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("sanity", func() {
ing := `
Expand Down Expand Up @@ -94,7 +94,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1beta1 upstream scheme", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1beta1 upstream scheme", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("sanity", func() {
ing := `
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-annotations/upstreamretry.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 upstream", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 upstream", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("Test timeout: 1 retry and long timeout", func() {
ing := `
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
)

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 websocket", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 websocket", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("sanity", func() {
resources := `
Expand Down Expand Up @@ -113,7 +113,7 @@ spec:
})
})

var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1beta1 with websocket", func() {
var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1beta1 with websocket", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("sanity", func() {
resources := `
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/suite-chore/consistency.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the CRDs re
assert.Nil(ginkgo.GinkgoT(), err)
assert.Len(ginkgo.GinkgoT(), upstreams, 1)
assert.Contains(ginkgo.GinkgoT(), upstreams[0].Name, "httpbin-service-e2e-test_80")

//Check the status of ApisixRoute resource
s.AssertCRSync("httpbin-route", "ar", "Sync Successfully")
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})
}
Expand All @@ -143,7 +144,7 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the CRDs re
})
})

var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress resource of the IngressController", func() {
var _ = ginkgo.PDescribe("suite-chore: Consistency between APISIX and the Ingress resource of the IngressController", func() {
s := scaffold.NewDefaultScaffold()
ginkgo.It("Ingress v1 and APISIX of route and upstream", func() {
httpService := fmt.Sprintf(_httpServiceConfig, "port1", 9080, 9080)
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/suite-chore/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ spec:
assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "checking number of routes")
assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "checking number of upstreams")

//Check the status of ApisixRoute resource
s.AssertCRSync("httpbin-route", "ar", "Sync Successfully")
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})

Expand Down
Loading