(t *testing.T)
| 49 | ) |
| 50 | |
| 51 | func testModeChangeServerOption(t *testing.T) grpc.ServerOption { |
| 52 | // Create a server option to get notified about serving mode changes. We don't |
| 53 | // do anything other than throwing a log entry here. But this is required, |
| 54 | // since the server code emits a log entry at the default level (which is |
| 55 | // ERROR) if no callback is registered for serving mode changes. Our |
| 56 | // testLogger fails the test if there is any log entry at ERROR level. It does |
| 57 | // provide an ExpectError() method, but that takes a string and it would be |
| 58 | // painful to construct the exact error message expected here. Instead this |
| 59 | // works just fine. |
| 60 | return xds.ServingModeCallback(func(addr net.Addr, args xds.ServingModeChangeArgs) { |
| 61 | t.Logf("Serving mode for listener %q changed to %q, err: %v", addr.String(), args.Mode, args.Err) |
| 62 | }) |
| 63 | } |
| 64 | |
| 65 | // acceptNotifyingListener wraps a listener and notifies users when a server |
| 66 | // calls the Listener.Accept() method. This can be used to ensure that the |
no test coverage detected