Skip to content

Commit

Permalink
Added unit tests for WAIT_FOR_ENVOY_TIMEOUT
Browse files Browse the repository at this point in the history
Lin Meyer committed Oct 6, 2020
1 parent cee80fd commit 895ae9c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -161,3 +161,21 @@ func TestWaitTillTimeoutForEnvoy(t *testing.T) {
}
}
}

// Tests scuttle will continue after WAIT_FOR_ENVOY_TIMEOUT expires and enovy is not ready
func TestWaitForEnvoyTimeoutContinueWithoutEnvoy(t *testing.T) {
fmt.Println("Starting TestWaitForEnvoyTimeoutContinueWithoutEnvoy")
os.Setenv("WAIT_FOR_ENVOY_TIMEOUT", "5s")
os.Setenv("ENVOY_ADMIN_API", badServer.URL)
initTestingEnv()
blockingCtx := waitForEnvoy()
<-blockingCtx.Done()
err := blockingCtx.Err()
if err == nil || !errors.Is(err, context.DeadlineExceeded) {
fmt.Println("TestWaitForEnvoyTimeoutContinueWithoutEnvoy err", err)
// Err is nil (enovy is up)
// or Err is set, but is not a cancellation err
// we expect a cancellation when the time is up
t.Fail()
}
}

0 comments on commit 895ae9c

Please sign in to comment.