carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package activator
2
3import (
4 "testing"
5 "time"
6)
7
8// The wait between health probes starts short, so a fast app is noticed
9// within milliseconds of binding, and doubles to a ceiling, so a slow one
10// is not probed in a busy loop.
11func TestHealthPollBacksOffFromShortToACeiling(t *testing.T) {
12 var got []time.Duration
13 d := time.Duration(0)
14 for range 7 {
15 d = nextHealthPoll(d)
16 got = append(got, d)
17 }
18 want := []time.Duration{5, 10, 20, 40, 50, 50, 50}
19 for i := range want {
20 if got[i] != want[i]*time.Millisecond {
21 t.Fatalf("delays = %v, want %v ms", got, want)
22 }
23 }
24}
25