Skip to content

Commit

Permalink
Merge 93afbd5 into 705b71a
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolyssup authored Mar 12, 2024
2 parents 705b71a + 93afbd5 commit 1e9c7dc
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion samples/deploy/crd/v1/ApisixRoute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
minItems: 1
items:
type: string
pattern: "^\\*?[0-9a-zA-Z-._]+$"
pattern: "^\\*?[0-9a-zA-Z-._\\[\\]:]+$"
methods:
type: array
minItems: 1
Expand Down
51 changes: 51 additions & 0 deletions test/e2e/suite-features/route_match_exprs.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,57 @@ spec:
assert.Contains(ginkgo.GinkgoT(), msg, "404 Route Not Found")
})

ginkgo.It("operator is equal (check with host and port)", func() {
backendSvc, backendPorts := s.DefaultHTTPBackend()

ar := fmt.Sprintf(`
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: httpbin-route
spec:
http:
- name: rule1
match:
hosts:
- httpbin.org:80
paths:
- /ip
exprs:
- subject:
scope: Header
name: X-Foo
op: Equal
value: bar
backends:
- serviceName: %s
servicePort: %d
`, backendSvc, backendPorts[0])

assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar))

time.Sleep(6 * time.Second)
err := s.EnsureNumApisixRoutesCreated(1)
assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
err = s.EnsureNumApisixUpstreamsCreated(1)
assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams")

_ = s.NewAPISIXClient().GET("/ip").
WithHeader("Host", "httpbin.org").
WithHeader("X-Foo", "bar").
Expect().
Status(http.StatusOK)

msg := s.NewAPISIXClient().GET("/ip").
WithHeader("Host", "httpbin.org").
WithHeader("X-Foo", "baz").
Expect().
Status(http.StatusNotFound).
Body().
Raw()
assert.Contains(ginkgo.GinkgoT(), msg, "404 Route Not Found")
})

ginkgo.It("operator is not_equal", func() {
backendSvc, backendPorts := s.DefaultHTTPBackend()

Expand Down

0 comments on commit 1e9c7dc

Please sign in to comment.