test: allow specifying HTTP protocol (#822)

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
罗泽轩
2024-02-20 11:29:05 +08:00
committed by GitHub
parent ae20420179
commit f277d4f6ae
5 changed files with 200 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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