MCPcopy Create free account
hub / github.com/goadesign/goa / TestServerGRPCInterface

Function TestServerGRPCInterface

grpc/codegen/server_test.go:13–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestServerGRPCInterface(t *testing.T) {
14 cases := []struct {
15 Name string
16 DSL func()
17 }{
18 {"unary-rpcs", testdata.UnaryRPCsDSL},
19 {"unary-rpc-no-payload", testdata.UnaryRPCNoPayloadDSL},
20 {"unary-rpc-no-result", testdata.UnaryRPCNoResultDSL},
21 {"unary-rpc-with-errors", testdata.UnaryRPCWithErrorsDSL},
22 {"unary-rpc-with-overriding-errors", testdata.UnaryRPCWithOverridingErrorsDSL},
23 {"server-streaming-rpc", testdata.ServerStreamingRPCDSL},
24 {"client-streaming-rpc", testdata.ClientStreamingRPCDSL},
25 {"client-streaming-rpc-with-payload", testdata.ClientStreamingRPCWithPayloadDSL},
26 {"bidirectional-streaming-rpc", testdata.BidirectionalStreamingRPCDSL},
27 {"bidirectional-streaming-rpc-with-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL},
28 {"bidirectional-streaming-rpc-with-errors", testdata.BidirectionalStreamingRPCWithErrorsDSL},
29 }
30 for _, c := range cases {
31 t.Run(c.Name, func(t *testing.T) {
32 root := RunGRPCDSL(t, c.DSL)
33 services := CreateGRPCServices(root)
34 fs := ServerFiles("", services)
35 require.Len(t, fs, 2)
36 sections := fs[0].Section("server-grpc-interface")
37 require.NotEmpty(t, sections)
38 code := codegen.SectionsCode(t, sections)
39 testutil.AssertGo(t, "testdata/golden/server_grpc_interface_"+c.Name+".go.golden", code)
40 })
41 }
42}
43
44func TestServerHandlerInit(t *testing.T) {
45 cases := []struct {

Callers

nothing calls this directly

Calls 7

SectionsCodeFunction · 0.92
AssertGoFunction · 0.92
RunGRPCDSLFunction · 0.85
CreateGRPCServicesFunction · 0.85
SectionMethod · 0.80
ServerFilesFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected