|
|
@@ -682,40 +682,44 @@ func controllerRun(t *testing.T, runConfig *controllerRunConfig) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Test: fetch website through tunnel
|
|
|
+ // Cannot establish port forwards in DisableApi mode
|
|
|
+ if !runConfig.disableApi {
|
|
|
|
|
|
- // Allow for known race condition described in NewHttpProxy():
|
|
|
- time.Sleep(1 * time.Second)
|
|
|
+ // Test: fetch website through tunnel
|
|
|
|
|
|
- fetchAndVerifyWebsite(t, httpProxyPort)
|
|
|
+ // Allow for known race condition described in NewHttpProxy():
|
|
|
+ time.Sleep(1 * time.Second)
|
|
|
|
|
|
- // Test: run for duration, periodically using the tunnel to
|
|
|
- // ensure failed tunnel detection, and ultimately hitting
|
|
|
- // impaired protocol checks.
|
|
|
+ fetchAndVerifyWebsite(t, httpProxyPort)
|
|
|
|
|
|
- startTime := monotime.Now()
|
|
|
+ // Test: run for duration, periodically using the tunnel to
|
|
|
+ // ensure failed tunnel detection, and ultimately hitting
|
|
|
+ // impaired protocol checks.
|
|
|
|
|
|
- for {
|
|
|
+ startTime := monotime.Now()
|
|
|
|
|
|
- time.Sleep(1 * time.Second)
|
|
|
- useTunnel(t, httpProxyPort)
|
|
|
+ for {
|
|
|
|
|
|
- if startTime.Add(runConfig.runDuration).Before(monotime.Now()) {
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
+ time.Sleep(1 * time.Second)
|
|
|
+ useTunnel(t, httpProxyPort)
|
|
|
|
|
|
- // Test: with disruptNetwork, impaired protocols should be exercised
|
|
|
+ if startTime.Add(runConfig.runDuration).Before(monotime.Now()) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if runConfig.runDuration > 0 && runConfig.disruptNetwork {
|
|
|
- count := atomic.LoadInt32(&impairedProtocolCount)
|
|
|
- if count <= 0 {
|
|
|
- t.Fatalf("unexpected impaired protocol count: %d", count)
|
|
|
- } else {
|
|
|
- impairedProtocolClassification.RLock()
|
|
|
- t.Logf("impaired protocol classification: %+v",
|
|
|
- impairedProtocolClassification.classification)
|
|
|
- impairedProtocolClassification.RUnlock()
|
|
|
+ // Test: with disruptNetwork, impaired protocols should be exercised
|
|
|
+
|
|
|
+ if runConfig.runDuration > 0 && runConfig.disruptNetwork {
|
|
|
+ count := atomic.LoadInt32(&impairedProtocolCount)
|
|
|
+ if count <= 0 {
|
|
|
+ t.Fatalf("unexpected impaired protocol count: %d", count)
|
|
|
+ } else {
|
|
|
+ impairedProtocolClassification.RLock()
|
|
|
+ t.Logf("impaired protocol classification: %+v",
|
|
|
+ impairedProtocolClassification.classification)
|
|
|
+ impairedProtocolClassification.RUnlock()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|