mirror of
https://github.com/alibaba/higress.git
synced 2026-02-24 20:50:51 +08:00
Feat https fallback (#1020)
This commit is contained in:
@@ -17,11 +17,8 @@ package tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alibaba/higress/test/e2e/conformance/utils/cert"
|
||||
"github.com/alibaba/higress/test/e2e/conformance/utils/http"
|
||||
"github.com/alibaba/higress/test/e2e/conformance/utils/kubernetes"
|
||||
"github.com/alibaba/higress/test/e2e/conformance/utils/suite"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -34,11 +31,6 @@ var ConfigmapHttps = suite.ConformanceTest{
|
||||
Manifests: []string{"tests/configmap-https.yaml"},
|
||||
Features: []suite.SupportedFeature{suite.HTTPConformanceFeature},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
// Prepare secrets for testcases
|
||||
_, _, caCert, caKey := cert.MustGenerateCaCert(t)
|
||||
svcCertOut, svcKeyOut := cert.MustGenerateCertWithCA(t, cert.ServerCertType, caCert, caKey, []string{"foo.com"})
|
||||
fooSecret := kubernetes.ConstructTLSSecret("higress-system", "foo-com-secret", svcCertOut.Bytes(), svcKeyOut.Bytes())
|
||||
suite.Applier.MustApplyObjectsWithCleanup(t, suite.Client, suite.TimeoutConfig, []client.Object{fooSecret}, suite.Cleanup)
|
||||
|
||||
testCases := []struct {
|
||||
httpAssert http.Assertion
|
||||
@@ -46,22 +38,80 @@ var ConfigmapHttps = suite.ConformanceTest{
|
||||
{
|
||||
httpAssert: http.Assertion{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "test configmap https",
|
||||
TestCaseName: "test configmap bar-com https",
|
||||
TargetBackend: "infra-backend-v2",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Path: "/foohttps",
|
||||
Host: "foo.com",
|
||||
Path: "/barhttps",
|
||||
Host: "bar.com",
|
||||
TLSConfig: &http.TLSConfig{
|
||||
SNI: "foo.com",
|
||||
SNI: "bar.com",
|
||||
},
|
||||
},
|
||||
ExpectedRequest: &http.ExpectedRequest{
|
||||
Request: http.Request{
|
||||
Path: "/foohttps",
|
||||
Host: "foo.com",
|
||||
Path: "/barhttps",
|
||||
Host: "bar.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
httpAssert: http.Assertion{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "test configmap a-foo-com https",
|
||||
TargetBackend: "infra-backend-v2",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Path: "/afoohttps",
|
||||
Host: "a.foo.com",
|
||||
TLSConfig: &http.TLSConfig{
|
||||
SNI: "a.foo.com",
|
||||
},
|
||||
},
|
||||
ExpectedRequest: &http.ExpectedRequest{
|
||||
Request: http.Request{
|
||||
Path: "/afoohttps",
|
||||
Host: "a.foo.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
httpAssert: http.Assertion{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "test configmap b-foo-com https",
|
||||
TargetBackend: "infra-backend-v2",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Path: "/bfoohttps",
|
||||
Host: "b.foo.com",
|
||||
TLSConfig: &http.TLSConfig{
|
||||
SNI: "b.foo.com",
|
||||
},
|
||||
},
|
||||
ExpectedRequest: &http.ExpectedRequest{
|
||||
Request: http.Request{
|
||||
Path: "/bfoohttps",
|
||||
Host: "b.foo.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user