feat(test): set global info for suite tests (#219)

Signed-off-by: bitliu <bitliu@tencent.com>
This commit is contained in:
Xunzhuo
2023-02-27 17:04:30 +08:00
committed by GitHub
parent 691493e945
commit 8c95fd938e
11 changed files with 22 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteCanaryHeader = suite.ConformanceTest{ var HTTPRouteCanaryHeader = suite.ConformanceTest{
ShortName: "HTTPRouteCanaryHeader", 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"}, Manifests: []string{"tests/httproute-canary-header.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteEnableCors = suite.ConformanceTest{ var HTTPRouteEnableCors = suite.ConformanceTest{
ShortName: "HTTPRouteEnableCors", 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"}, Manifests: []string{"tests/httproute-enable-cors.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteHostNameSameNamespace = suite.ConformanceTest{ var HTTPRouteHostNameSameNamespace = suite.ConformanceTest{
ShortName: "HTTPRouteHostNameSameNamespace", 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"}, Manifests: []string{"tests/httproute-hostname-same-namespace.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteIgnoreCaseMatch = suite.ConformanceTest{ var HTTPRouteIgnoreCaseMatch = suite.ConformanceTest{
ShortName: "HTTPRouteIgnoreCaseMatch", 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"}, Manifests: []string{"tests/httproute-ignore-case-match.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteMatchHeaders = suite.ConformanceTest{ var HTTPRouteMatchHeaders = suite.ConformanceTest{
ShortName: "HTTPRouteMatchHeaders", 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"}, Manifests: []string{"tests/httproute-match-headers.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteMatchMethods = suite.ConformanceTest{ var HTTPRouteMatchMethods = suite.ConformanceTest{
ShortName: "HTTPRouteMatchMethods", 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"}, Manifests: []string{"tests/httproute-match-methods.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteMatchQueryParams = suite.ConformanceTest{ var HTTPRouteMatchQueryParams = suite.ConformanceTest{
ShortName: "HTTPRouteMatchQueryParams", 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"}, Manifests: []string{"tests/httproute-match-query-params.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteRewriteHost = suite.ConformanceTest{ var HTTPRouteRewriteHost = suite.ConformanceTest{
ShortName: "HTTPRouteRewriteHost", 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"}, Manifests: []string{"tests/httproute-rewrite-host.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
testcases := []http.Assertion{ testcases := []http.Assertion{

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteRewritePath = suite.ConformanceTest{ var HTTPRouteRewritePath = suite.ConformanceTest{
ShortName: "HTTPRouteRewritePath", 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"}, Manifests: []string{"tests/httproute-rewrite-path.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {

View File

@@ -27,7 +27,7 @@ func init() {
var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{ var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{
ShortName: "HTTPRouteSimpleSameNamespace", 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"}, Manifests: []string{"tests/httproute-simple-same-namespace.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
t.Run("Simple HTTP request should reach infra-backend", func(t *testing.T) { t.Run("Simple HTTP request should reach infra-backend", func(t *testing.T) {

View File

@@ -15,6 +15,7 @@
package suite package suite
import ( import (
"fmt"
"testing" "testing"
"github.com/alibaba/higress/test/ingress/conformance/utils/config" "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. // Run runs the provided set of conformance tests.
func (suite *ConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest) { 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 { for _, test := range tests {
t.Run(test.ShortName, func(t *testing.T) { t.Run(test.ShortName, func(t *testing.T) {
test.Run(t, suite) 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. // ConformanceTest is used to define each individual conformance test.
type ConformanceTest struct { type ConformanceTest struct {
ShortName string ShortName string