generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gamma: initial mesh conformance tests
- Loading branch information
1 parent
d6acbb6
commit ef75c8a
Showing
15 changed files
with
801 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: gateway-conformance-mesh | ||
labels: | ||
gateway-conformance: infra | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: echo-v1 | ||
namespace: gateway-conformance-mesh | ||
labels: | ||
app: echo | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: echo | ||
version: v1 | ||
template: | ||
metadata: | ||
labels: | ||
app: echo | ||
version: v1 | ||
spec: | ||
containers: | ||
- name: echo | ||
image: gcr.io/istio-testing/app:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- --tcp=9090 | ||
- --port=80 | ||
- --grpc=7070 | ||
- --port=443 | ||
- --tls=443 | ||
- --crt=/cert.crt | ||
- --key=/cert.key | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: echo-v1 | ||
namespace: gateway-conformance-mesh | ||
spec: | ||
selector: | ||
app: echo | ||
version: v1 | ||
ports: | ||
- name: http | ||
port: 80 | ||
- name: https | ||
port: 443 | ||
- name: tcp | ||
port: 9090 | ||
- name: tcp-sf | ||
port: 9091 | ||
- name: grpc | ||
port: 7070 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: echo-v2 | ||
namespace: gateway-conformance-mesh | ||
labels: | ||
app: echo | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: echo | ||
version: v2 | ||
template: | ||
metadata: | ||
labels: | ||
app: echo | ||
version: v2 | ||
spec: | ||
containers: | ||
- name: echo | ||
image: gcr.io/istio-testing/app:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- --tcp=9090 | ||
- --port=80 | ||
- --grpc=7070 | ||
- --port=443 | ||
- --tls=443 | ||
- --crt=/cert.crt | ||
- --key=/cert.key | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: echo-v2 | ||
namespace: gateway-conformance-mesh | ||
spec: | ||
selector: | ||
app: echo | ||
version: v2 | ||
ports: | ||
- name: http | ||
port: 80 | ||
- name: https | ||
port: 443 | ||
- name: tcp | ||
port: 9090 | ||
- name: grpc | ||
port: 7070 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: echo | ||
namespace: gateway-conformance-mesh | ||
spec: | ||
selector: | ||
app: echo | ||
ports: | ||
- name: http | ||
port: 80 | ||
- name: https | ||
port: 443 | ||
- name: tcp | ||
port: 9090 | ||
- name: tcp-sf | ||
port: 9091 | ||
- name: grpc | ||
port: 7070 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"sigs.k8s.io/gateway-api/conformance/utils/echo" | ||
"sigs.k8s.io/gateway-api/conformance/utils/http" | ||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
) | ||
|
||
func init() { | ||
MeshConformanceTests = append(MeshConformanceTests, MeshBasic) | ||
} | ||
|
||
var MeshBasic = suite.ConformanceTest{ | ||
ShortName: "MeshBasic", | ||
Description: "A mesh client can communicate with a mesh server. This tests basic reachability with no configuration applied.", | ||
Manifests: []string{}, | ||
Test: func(t *testing.T, s *suite.ConformanceTestSuite) { | ||
client := echo.ConnectToApp(t, s, echo.MeshAppEchoV1) | ||
cases := []http.ExpectedResponse{{ | ||
Request: http.Request{ | ||
Host: "echo", | ||
Method: "GET", | ||
}, | ||
Response: http.Response{ | ||
StatusCode: 200, | ||
}, | ||
}} | ||
for i := range cases { | ||
// Declare tc here to avoid loop variable | ||
// reuse issues across parallel tests. | ||
tc := cases[i] | ||
t.Run(tc.GetTestCaseName(i), func(t *testing.T) { | ||
client.SendRequest(t, tc) | ||
}) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"sigs.k8s.io/gateway-api/conformance/utils/echo" | ||
"sigs.k8s.io/gateway-api/conformance/utils/http" | ||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
) | ||
|
||
func init() { | ||
MeshConformanceTests = append(MeshConformanceTests, MeshTrafficSplit) | ||
} | ||
|
||
var MeshTrafficSplit = suite.ConformanceTest{ | ||
ShortName: "MeshTrafficSplit", | ||
Description: "A mesh client can send traffic to a Service which is split between two versions", | ||
Manifests: []string{"tests/mesh-split.yaml"}, | ||
Test: func(t *testing.T, s *suite.ConformanceTestSuite) { | ||
client := echo.ConnectToApp(t, s, echo.MeshAppEchoV1) | ||
cases := []http.ExpectedResponse{ | ||
{ | ||
Request: http.Request{ | ||
Host: "echo", | ||
Method: "GET", | ||
Path: "/v1", | ||
}, | ||
Response: http.Response{ | ||
StatusCode: 200, | ||
}, | ||
Backend: "echo-v1", | ||
}, | ||
{ | ||
Request: http.Request{ | ||
Host: "echo", | ||
Method: "GET", | ||
Path: "/v2", | ||
}, | ||
Response: http.Response{ | ||
StatusCode: 200, | ||
}, | ||
Backend: "echo-v2", | ||
}, | ||
} | ||
for i := range cases { | ||
// Declare tc here to avoid loop variable | ||
// reuse issues across parallel tests. | ||
tc := cases[i] | ||
t.Run(tc.GetTestCaseName(i), func(t *testing.T) { | ||
client.SendRequest(t, tc) | ||
}) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: mesh-split | ||
namespace: gateway-conformance-mesh | ||
spec: | ||
parentRefs: | ||
- kind: Service | ||
name: echo | ||
rules: | ||
- matches: | ||
- path: | ||
type: Exact | ||
value: /v1 | ||
backendRefs: | ||
- name: echo-v1 | ||
port: 80 | ||
- matches: | ||
- path: | ||
type: Exact | ||
value: /v2 | ||
backendRefs: | ||
- name: echo-v2 | ||
port: 80 |
Oops, something went wrong.