Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed May 4, 2024
1 parent b81ba86 commit 2cad2cb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 11 deletions.
24 changes: 24 additions & 0 deletions operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,30 @@ func TestGrpc(t *testing.T) {
}
}

func TestGrpcWithoutReflection(t *testing.T) {
tests := []struct {
book string
}{
{"testdata/book/grpc.yml"},
{"testdata/book/grpc_with_json.yml"},
}
ctx := context.Background()
ts := testutil.GRPCServer(t, true, true)
t.Setenv("TEST_GRPC_ADDR", ts.Addr())
for _, tt := range tests {
t.Run(tt.book, func(t *testing.T) {
t.Parallel()
o, err := New(Book(tt.book))
if err != nil {
t.Fatal(err)
}
if err := o.Run(ctx); err != nil {
t.Error(err)
}
})
}
}

func TestDB(t *testing.T) {
tests := []struct {
book string
Expand Down
10 changes: 5 additions & 5 deletions testdata/book/grpc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
desc: Test using gRPC
runners:
greq:
addr: grpc://grpc.example.com:443
protos:
- ../grpctest.proto
bufLocks:
- ../buf.lock
addr: ${TEST_GRPC_ADDR-:grpc.example.com:443}
tls: true
skipVerify: true
bufDirs:
- ../
vars:
names:
- alice
Expand Down
9 changes: 8 additions & 1 deletion testdata/book/grpc_with_json.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
desc: Test using gRPC with JSON
runners:
greq: grpc://grpc.example.com:443
greq:
addr: ${TEST_GRPC_ADDR-:grpc.example.com:443}
tls: true
skipVerify: true
importPaths:
- ../
bufLocks:
- ../buf.lock
vars:
message: "json://grpc_with_json.json"
steps:
Expand Down
10 changes: 5 additions & 5 deletions testdata/grpc.yml.runbook.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
desc: Captured of grpc.yml run
runners:
greq:
addr: grpc://grpc.example.com:443
protos:
- ../grpctest.proto
bufLocks:
- ../buf.lock
addr: ${TEST_GRPC_ADDR-:grpc.example.com:443}
tls: true
skipVerify: true
bufDirs:
- ../
steps:
- greq:
grpctest.GrpcTestService/Hello:
Expand Down

0 comments on commit 2cad2cb

Please sign in to comment.