(client testgrpc.TestServiceClient, fallbackDeadline time.Time)
| 127 | } |
| 128 | |
| 129 | func waitForFallbackAndDoRPCs(client testgrpc.TestServiceClient, fallbackDeadline time.Time) { |
| 130 | fallbackRetryCount := 0 |
| 131 | fellBack := false |
| 132 | for time.Now().Before(fallbackDeadline) { |
| 133 | g := doRPCAndGetPath(client, 20*time.Second) |
| 134 | if g == testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK { |
| 135 | infoLog.Println("Made one successful RPC to a fallback. Now expect the same for the rest.") |
| 136 | fellBack = true |
| 137 | break |
| 138 | } else if g == testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND { |
| 139 | errorLog.Fatalf("Got RPC type backend. This suggests an error in test implementation") |
| 140 | } else { |
| 141 | infoLog.Println("Retryable RPC failure on iteration:", fallbackRetryCount) |
| 142 | } |
| 143 | fallbackRetryCount++ |
| 144 | } |
| 145 | if !fellBack { |
| 146 | infoLog.Fatalf("Didn't fall back before deadline: %v\n", fallbackDeadline) |
| 147 | } |
| 148 | for i := 0; i < 30; i++ { |
| 149 | if g := doRPCAndGetPath(client, 20*time.Second); g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK { |
| 150 | errorLog.Fatalf("Expected RPC to take grpclb route type FALLBACK. Got: %v", g) |
| 151 | } |
| 152 | time.Sleep(time.Second) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | func doFallbackBeforeStartup() { |
| 157 | runCmd(*induceFallbackCmd) |
no test coverage detected