MCPcopy
hub / github.com/grpc/grpc-go / TestMalformedStreamMethod

Method TestMalformedStreamMethod

test/end2end_test.go:5609–5621  ·  view source on GitHub ↗

TestMalformedStreamMethod starts a test server and sends an RPC with a malformed method name. The server should respond with an UNIMPLEMENTED status code in this case.

(t *testing.T)

Source from the content-addressed store, hash-verified

5607// malformed method name. The server should respond with an UNIMPLEMENTED status
5608// code in this case.
5609func (s) TestMalformedStreamMethod(t *testing.T) {
5610 const testMethod = "a-method-name-without-any-slashes"
5611 te := newTest(t, tcpClearRREnv)
5612 te.startServer(nil)
5613 defer te.tearDown()
5614
5615 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
5616 defer cancel()
5617 err := te.clientConn().Invoke(ctx, testMethod, nil, nil)
5618 if gotCode := status.Code(err); gotCode != codes.Unimplemented {
5619 t.Fatalf("Invoke with method %q, got code %s, want %s", testMethod, gotCode, codes.Unimplemented)
5620 }
5621}
5622
5623func (s) TestMethodFromServerStream(t *testing.T) {
5624 const testMethod = "/package.service/method"

Callers

nothing calls this directly

Calls 7

CodeMethod · 0.80
newTestFunction · 0.70
InvokeMethod · 0.65
FatalfMethod · 0.65
startServerMethod · 0.45
tearDownMethod · 0.45
clientConnMethod · 0.45

Tested by

no test coverage detected