Skip to content

Commit

Permalink
test(api-server): add gateway inspect dataplanes test
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <[email protected]>
  • Loading branch information
michaelbeaumont committed Mar 31, 2022
1 parent 00c0bf3 commit 1917369
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
37 changes: 37 additions & 0 deletions pkg/api-server/inspect_endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,43 @@ var _ = Describe("Inspect WS", func() {
},
},
}),
Entry("inspect meshgateway dataplanes", testCase{
path: "/meshes/default/meshgateways/gateway/dataplanes",
goldenFile: "inspect_gateway_dataplanes.json",
resources: []core_model.Resource{
newMesh("default"),
newDataplane().
meta("gateway-1", "default").
builtin("gateway").
build(),
newDataplane().
meta("othergateway-1", "default").
builtin("othergateway").
build(),
newDataplane().
meta("redis-1", "default").
inbound80to81("redis", "192.168.0.1").
outbound8080("backend", "192.168.0.2").
outbound8080("gateway", "192.168.0.3").
build(),
&core_mesh.MeshGatewayResource{
Meta: &test_model.ResourceMeta{Name: "gateway", Mesh: "default"},
Spec: &mesh_proto.MeshGateway{
Selectors: selectors{
serviceSelector("gateway", ""),
},
Conf: &mesh_proto.MeshGateway_Conf{
Listeners: []*mesh_proto.MeshGateway_Listener{
{
Protocol: mesh_proto.MeshGateway_Listener_HTTP,
Port: 80,
},
},
},
},
},
},
}),
Entry("inspect traffic permission", testCase{
path: "/meshes/default/traffic-permissions/tp-1/dataplanes",
goldenFile: "inspect_traffic-permission.json",
Expand Down
11 changes: 11 additions & 0 deletions pkg/api-server/testdata/inspect_gateway_dataplanes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"total": 1,
"items": [
{
"dataplane": {
"mesh": "default",
"name": "gateway-1"
}
}
]
}

0 comments on commit 1917369

Please sign in to comment.