(t *testing.T, e env)
| 1841 | } |
| 1842 | |
| 1843 | func testMaxMsgSizeClientDefault(t *testing.T, e env) { |
| 1844 | te := newTest(t, e) |
| 1845 | te.userAgent = testAppUA |
| 1846 | te.declareLogNoise( |
| 1847 | "Failed to dial : context canceled; please retry.", |
| 1848 | ) |
| 1849 | te.startServer(&testServer{security: e.security}) |
| 1850 | |
| 1851 | defer te.tearDown() |
| 1852 | tc := testgrpc.NewTestServiceClient(te.clientConn()) |
| 1853 | |
| 1854 | const smallSize = 1 |
| 1855 | const largeSize = 4 * 1024 * 1024 |
| 1856 | smallPayload, err := newPayload(testpb.PayloadType_COMPRESSABLE, smallSize) |
| 1857 | if err != nil { |
| 1858 | t.Fatal(err) |
| 1859 | } |
| 1860 | req := &testpb.SimpleRequest{ |
| 1861 | ResponseType: testpb.PayloadType_COMPRESSABLE, |
| 1862 | ResponseSize: int32(largeSize), |
| 1863 | Payload: smallPayload, |
| 1864 | } |
| 1865 | |
| 1866 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 1867 | defer cancel() |
| 1868 | // Test for unary RPC recv. |
| 1869 | if _, err := tc.UnaryCall(ctx, req); err == nil || status.Code(err) != codes.ResourceExhausted { |
| 1870 | t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.ResourceExhausted) |
| 1871 | } |
| 1872 | |
| 1873 | respParam := []*testpb.ResponseParameters{ |
| 1874 | { |
| 1875 | Size: int32(largeSize), |
| 1876 | }, |
| 1877 | } |
| 1878 | sreq := &testpb.StreamingOutputCallRequest{ |
| 1879 | ResponseType: testpb.PayloadType_COMPRESSABLE, |
| 1880 | ResponseParameters: respParam, |
| 1881 | Payload: smallPayload, |
| 1882 | } |
| 1883 | |
| 1884 | // Test for streaming RPC recv. |
| 1885 | stream, err := tc.FullDuplexCall(te.ctx) |
| 1886 | if err != nil { |
| 1887 | t.Fatalf("%v.FullDuplexCall(_) = _, %v, want <nil>", tc, err) |
| 1888 | } |
| 1889 | if err := stream.Send(sreq); err != nil { |
| 1890 | t.Fatalf("%v.Send(%v) = %v, want <nil>", stream, sreq, err) |
| 1891 | } |
| 1892 | if _, err := stream.Recv(); err == nil || status.Code(err) != codes.ResourceExhausted { |
| 1893 | t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted) |
| 1894 | } |
| 1895 | } |
| 1896 | |
| 1897 | func (s) TestMaxMsgSizeClientAPI(t *testing.T) { |
| 1898 | for _, e := range listTestEnv() { |
no test coverage detected