mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 20:17:29 +08:00
feat(test): set global info for suite tests (#219)
Signed-off-by: bitliu <bitliu@tencent.com>
This commit is contained in:
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteCanaryHeader = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteCanaryHeader",
|
||||
Description: "The Ingress in the higress-conformance-infra namespace uses the canary header traffic split",
|
||||
Description: "The Ingress in the higress-conformance-infra namespace uses the canary header traffic split.",
|
||||
Manifests: []string{"tests/httproute-canary-header.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteEnableCors = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteEnableCors",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace demonstrates enable cors ability",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace demonstrates enable cors ability.",
|
||||
Manifests: []string{"tests/httproute-enable-cors.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteHostNameSameNamespace = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteHostNameSameNamespace",
|
||||
Description: "A Ingress in the higress-conformance-infra namespace demonstrates host match ability",
|
||||
Description: "A Ingress in the higress-conformance-infra namespace demonstrates host match ability.",
|
||||
Manifests: []string{"tests/httproute-hostname-same-namespace.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteIgnoreCaseMatch = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteIgnoreCaseMatch",
|
||||
Description: "A Ingress in the higress-conformance-infra namespace that ignores URI case in HTTP match",
|
||||
Description: "A Ingress in the higress-conformance-infra namespace that ignores URI case in HTTP match.",
|
||||
Manifests: []string{"tests/httproute-ignore-case-match.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteMatchHeaders = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteMatchHeaders",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the match headers",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the match headers.",
|
||||
Manifests: []string{"tests/httproute-match-headers.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteMatchMethods = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteMatchMethods",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the match methods",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the match methods.",
|
||||
Manifests: []string{"tests/httproute-match-methods.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteMatchQueryParams = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteMatchQueryParams",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the match queryParams",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the match queryParams.",
|
||||
Manifests: []string{"tests/httproute-match-query-params.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteRewriteHost = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteRewriteHost",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the rewrite host",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the rewrite host.",
|
||||
Manifests: []string{"tests/httproute-rewrite-host.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
testcases := []http.Assertion{
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteRewritePath = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteRewritePath",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the rewrite path",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace uses the rewrite path.",
|
||||
Manifests: []string{"tests/httproute-rewrite-path.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{
|
||||
ShortName: "HTTPRouteSimpleSameNamespace",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace demonstrates basic routing ability",
|
||||
Description: "A single Ingress in the higress-conformance-infra namespace demonstrates basic routing ability.",
|
||||
Manifests: []string{"tests/httproute-simple-same-namespace.yaml"},
|
||||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
|
||||
t.Run("Simple HTTP request should reach infra-backend", func(t *testing.T) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package suite
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/alibaba/higress/test/ingress/conformance/utils/config"
|
||||
@@ -164,6 +165,8 @@ func (suite *ConformanceTestSuite) Setup(t *testing.T) {
|
||||
|
||||
// Run runs the provided set of conformance tests.
|
||||
func (suite *ConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest) {
|
||||
|
||||
t.Logf("Start Running %d Test Cases: \n\n%s", len(tests), globalConformanceTestsListInfo(tests))
|
||||
for _, test := range tests {
|
||||
t.Run(test.ShortName, func(t *testing.T) {
|
||||
test.Run(t, suite)
|
||||
@@ -171,6 +174,15 @@ func (suite *ConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest) {
|
||||
}
|
||||
}
|
||||
|
||||
func globalConformanceTestsListInfo(tests []ConformanceTest) string {
|
||||
var cases string
|
||||
for index, test := range tests {
|
||||
cases += fmt.Sprintf("CaseNum: %d\nCaseName: %s\nScenario: %s\n\n", index+1, test.ShortName, test.Description)
|
||||
}
|
||||
|
||||
return cases
|
||||
}
|
||||
|
||||
// ConformanceTest is used to define each individual conformance test.
|
||||
type ConformanceTest struct {
|
||||
ShortName string
|
||||
|
||||
Reference in New Issue
Block a user