...

Source file src/sigs.k8s.io/gateway-api/conformance/tests/mesh-basic.go

Documentation: sigs.k8s.io/gateway-api/conformance/tests

     1  /*
     2  Copyright 2023 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package tests
    18  
    19  import (
    20  	"testing"
    21  
    22  	"sigs.k8s.io/gateway-api/conformance/utils/echo"
    23  	"sigs.k8s.io/gateway-api/conformance/utils/http"
    24  	"sigs.k8s.io/gateway-api/conformance/utils/suite"
    25  )
    26  
    27  func init() {
    28  	ConformanceTests = append(ConformanceTests, MeshBasic)
    29  }
    30  
    31  var MeshBasic = suite.ConformanceTest{
    32  	ShortName:   "MeshBasic",
    33  	Description: "A mesh client can communicate with a mesh server. This tests basic reachability with no configuration applied.",
    34  	Features: []suite.SupportedFeature{
    35  		suite.SupportMesh,
    36  	},
    37  	Manifests: []string{},
    38  	Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
    39  		client := echo.ConnectToApp(t, s, echo.MeshAppEchoV1)
    40  		cases := []http.ExpectedResponse{{
    41  			Request: http.Request{
    42  				Host:   "echo",
    43  				Method: "GET",
    44  			},
    45  			Response: http.Response{
    46  				StatusCode: 200,
    47  			},
    48  		}}
    49  		for i := range cases {
    50  			// Declare tc here to avoid loop variable
    51  			// reuse issues across parallel tests.
    52  			tc := cases[i]
    53  			t.Run(tc.GetTestCaseName(i), func(t *testing.T) {
    54  				client.MakeRequestAndExpectEventuallyConsistentResponse(t, tc, s.TimeoutConfig)
    55  			})
    56  		}
    57  	},
    58  }
    59  

View as plain text