The controller's last-heard word for a machine comes from the watchman's presence in nodes, node, status and the watchdogs (issue 1183, AC1, AC2)
This commit is contained in:
@@ -91,7 +91,7 @@ func TestAStuckPresenceKeyIsTheSilentVerdict(t *testing.T) { // 1156/AC2
|
||||
}
|
||||
}
|
||||
|
||||
// 1156/AC3: with a presence entry that says offline, last heard is the later of last_seen and the entry's time; with none,
|
||||
// 1156/AC3: with a presence entry that says offline, last heard is the entry's time (1183/AC1); with none,
|
||||
// last_seen. An entry that says online counts as heard now: the watchman writes it only when it changes, so its time is
|
||||
// when the machine connected, and a machine online for hours with no stuck key is not silent, whatever last_seen says.
|
||||
func TestLastHeardFollowsThePresenceEntry(t *testing.T) { // 1156/AC3
|
||||
@@ -109,8 +109,8 @@ func TestLastHeardFollowsThePresenceEntry(t *testing.T) { // 1156/AC3
|
||||
}
|
||||
m = machineFacts{name: "laptop", lastHeard: now.Add(-time.Minute), every: time.Minute}
|
||||
applyPresence(&m, nil, &presenceEntry{Online: false, At: now.Add(-time.Hour)}, now)
|
||||
if !m.lastHeard.Equal(now.Add(-time.Minute)) {
|
||||
t.Fatalf("an older entry replaced a newer last_seen: %v", m.lastHeard)
|
||||
if !m.lastHeard.Equal(now.Add(-time.Hour)) {
|
||||
t.Fatalf("an offline entry's time is last heard, not a report: %v", m.lastHeard)
|
||||
}
|
||||
for _, lastSeen := range []time.Duration{10 * time.Second, 5 * time.Hour} {
|
||||
m := machineFacts{name: "laptop", lastHeard: now.Add(-lastSeen), every: time.Minute}
|
||||
|
||||
Reference in New Issue
Block a user