mirror of
https://github.com/alibaba/higress.git
synced 2026-04-22 04:27:26 +08:00
test: allow specifying HTTP protocol (#822)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
@@ -89,6 +89,70 @@ var WasmPluginsSniMisdirect = suite.ConformanceTest{
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "case 3: https/2.0 request with sni and same with host",
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Protocol: "HTTP/2.0",
|
||||
Host: "foo.com",
|
||||
Path: "/foo",
|
||||
Headers: map[string]string{
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
TLSConfig: &http.TLSConfig{
|
||||
SNI: "foo.com",
|
||||
Certificates: http.Certificates{
|
||||
CACerts: [][]byte{caCertOut.Bytes()},
|
||||
ClientKeyPairs: []http.ClientKeyPair{{
|
||||
ClientCert: cliCertOut.Bytes(),
|
||||
ClientKey: cliKeyOut.Bytes()},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "case 4: https/2.0 request with sni and not same with host",
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Protocol: "HTTP/2.0",
|
||||
Host: "bar.com",
|
||||
Path: "/foo",
|
||||
Headers: map[string]string{
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
TLSConfig: &http.TLSConfig{
|
||||
SNI: "foo.com",
|
||||
Certificates: http.Certificates{
|
||||
CACerts: [][]byte{caCertOut.Bytes()},
|
||||
ClientKeyPairs: []http.ClientKeyPair{{
|
||||
ClientCert: cliCertOut.Bytes(),
|
||||
ClientKey: cliKeyOut.Bytes()},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 421,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
t.Run("WasmPlugin sni-misdirect", func(t *testing.T) {
|
||||
|
||||
@@ -23,10 +23,10 @@ spec:
|
||||
ingressClassName: higress
|
||||
tls:
|
||||
- hosts:
|
||||
- "foo.com"
|
||||
- "*.com"
|
||||
secretName: foo-secret
|
||||
rules:
|
||||
- host: "foo.com"
|
||||
- host: "*.com"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Exact
|
||||
|
||||
Reference in New Issue
Block a user