Skip to content

Commit

Permalink
test: move grpc test scaffold out of the test framework
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
  • Loading branch information
spacewander committed Oct 17, 2024
1 parent 88fb116 commit 4c37df0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
17 changes: 0 additions & 17 deletions api/plugins/tests/integration/dataplane/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ static_resources:
end
function envoy_on_response(handle)
end
- match:
prefix: /api.tests.
route:
cluster: grpc_backend
- name: dynamic_config
internal_listener: {}
filter_chains:
Expand Down Expand Up @@ -246,19 +242,6 @@ static_resources:
socket_address:
address: 127.0.0.1
port_value: 10001
- name: grpc_backend
type: strict_dns
lb_policy: round_robin
http2_protocol_options: {}
load_assignment:
cluster_name: grpc_backend
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: grpc
port_value: 50051
- name: config_server
connect_timeout: 0.25s
type: strict_dns
Expand Down
11 changes: 11 additions & 0 deletions api/tests/integration/filtermanager_latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package integration

import (
"bytes"
_ "embed"
"net/http"
"os"
"path/filepath"
Expand All @@ -32,6 +33,13 @@ import (
"mosn.io/htnn/api/plugins/tests/integration/helper"
)

var (
//go:embed testdata/grpc_route.yml
grpcRoute string
//go:embed testdata/grpc_backend.yml
grpcBackend string
)

func TestFilterManagerTrailers(t *testing.T) {
dp, err := dataplane.StartDataPlane(t, &dataplane.Option{})
if err != nil {
Expand Down Expand Up @@ -224,6 +232,9 @@ func grpcurl(dp *dataplane.DataPlane, fullMethodName, req string) ([]byte, error
func TestFilterManagerTrailersWithGrpcBackend(t *testing.T) {
dp, err := dataplane.StartDataPlane(t, &dataplane.Option{
LogLevel: "debug",
Bootstrap: dataplane.Bootstrap().
AddBackendRoute(grpcRoute).
AddCluster(grpcBackend),
})
if err != nil {
t.Fatalf("failed to start data plane: %v", err)
Expand Down
13 changes: 13 additions & 0 deletions api/tests/integration/testdata/grpc_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: grpc_backend
type: strict_dns
lb_policy: round_robin
http2_protocol_options: {}
load_assignment:
cluster_name: grpc_backend
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: grpc
port_value: 50051
4 changes: 4 additions & 0 deletions api/tests/integration/testdata/grpc_route.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
match:
prefix: /api.tests.
route:
cluster: grpc_backend
1 change: 1 addition & 0 deletions api/tests/integration/testdata/services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
build: ./grpc
ports:
- "50051:50051"
restart: unless-stopped
networks:
service:

Expand Down
2 changes: 1 addition & 1 deletion plugins/tests/integration/ext_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

var (
//go:embed ext_auth_route.yml
//go:embed testdata/ext_auth_route.yml
extAuthRoute string
)

Expand Down

0 comments on commit 4c37df0

Please sign in to comment.