mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
parent
c32dd276df
commit
331be19af6
|
@ -21,7 +21,7 @@ func TestInterfaces(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
_ Target = &target{}
|
_ Target = &target{}
|
||||||
_ TargetManager = &targetManager{}
|
_ TargetManager = &targetManager{}
|
||||||
_ healthReporter = target{}
|
_ healthReporter = &target{}
|
||||||
_ scheduler = &healthScheduler{}
|
_ scheduler = &healthScheduler{}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,42 @@ func testHealthScheduler(t test.Tester) {
|
||||||
expectedSchedule: []time.Time{now, now.Add(time.Second * 2), now.Add(time.Minute * 2)},
|
expectedSchedule: []time.Time{now, now.Add(time.Second * 2), now.Add(time.Minute * 2)},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
futureHealthState: []TargetState{UNKNOWN, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE, UNREACHABLE},
|
futureHealthState: []TargetState{
|
||||||
preloadedTimes: []time.Time{now, now.Add(time.Minute), now.Add(time.Minute * 2), now.Add(time.Minute * 3), now.Add(time.Minute * 4), now.Add(time.Minute * 5), now.Add(time.Minute * 6), now.Add(time.Minute * 7), now.Add(time.Minute * 8), now.Add(time.Minute * 9), now.Add(time.Minute * 10), now.Add(time.Minute * 11), now.Add(time.Minute * 12)},
|
UNKNOWN,
|
||||||
expectedSchedule: []time.Time{now, now.Add(time.Second * 2), now.Add(time.Minute * 1).Add(time.Second * 4), now.Add(time.Minute * 2).Add(time.Second * 8), now.Add(time.Minute * 3).Add(time.Second * 16), now.Add(time.Minute * 4).Add(time.Second * 32), now.Add(time.Minute * 5).Add(time.Second * 64), now.Add(time.Minute * 6).Add(time.Second * 128), now.Add(time.Minute * 7).Add(time.Second * 256), now.Add(time.Minute * 8).Add(time.Second * 512), now.Add(time.Minute * 9).Add(time.Second * 1024), now.Add(time.Minute * 10).Add(time.Minute * 30), now.Add(time.Minute * 11).Add(time.Minute * 30)},
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
UNREACHABLE,
|
||||||
|
},
|
||||||
|
preloadedTimes: []time.Time{
|
||||||
|
now,
|
||||||
|
now.Add(time.Minute),
|
||||||
|
now.Add(time.Minute * 2),
|
||||||
|
now.Add(time.Minute * 3),
|
||||||
|
now.Add(time.Minute * 4),
|
||||||
|
now.Add(time.Minute * 5),
|
||||||
|
now.Add(time.Minute * 6),
|
||||||
|
now.Add(time.Minute * 7),
|
||||||
|
now.Add(time.Minute * 8),
|
||||||
|
now.Add(time.Minute * 9),
|
||||||
|
},
|
||||||
|
expectedSchedule: []time.Time{
|
||||||
|
now,
|
||||||
|
now.Add(time.Second * 2),
|
||||||
|
now.Add(time.Minute * 1).Add(time.Second * 4),
|
||||||
|
now.Add(time.Minute * 2).Add(time.Second * 8),
|
||||||
|
now.Add(time.Minute * 3).Add(time.Second * 16),
|
||||||
|
now.Add(time.Minute * 4).Add(time.Second * 32),
|
||||||
|
now.Add(time.Minute * 5).Add(time.Second * 64),
|
||||||
|
now.Add(time.Minute * 6).Add(time.Minute * 2),
|
||||||
|
now.Add(time.Minute * 7).Add(time.Minute * 2),
|
||||||
|
now.Add(time.Minute * 8).Add(time.Minute * 2),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,8 @@ func (t *fakeTarget) ScheduledFor() (time time.Time) {
|
||||||
|
|
||||||
func (t *fakeTarget) Merge(newTarget Target) {}
|
func (t *fakeTarget) Merge(newTarget Target) {}
|
||||||
|
|
||||||
|
func (t *fakeTarget) EstimatedTimeToExecute() time.Duration { return 0 }
|
||||||
|
|
||||||
func testTargetManager(t test.Tester) {
|
func testTargetManager(t test.Tester) {
|
||||||
results := make(chan *extraction.Result, 5)
|
results := make(chan *extraction.Result, 5)
|
||||||
targetManager := NewTargetManager(results, 3)
|
targetManager := NewTargetManager(results, 3)
|
||||||
|
|
Loading…
Reference in a new issue