test: resolve registered VM key in freshness check
This commit is contained in:
1 parent
d36d3ed0d6
commit
3bfbc3604d
1 file changed
+9
-3
@@ -89,9 +89,15 @@ func TestActiveWindowReporting(t *testing.T) {
|
||||
if got, ok := srv.ActiveWindow("mac-one", time.Second); !ok || got != window {
|
||||
t.Fatalf("active window = %+v, %t", got, ok)
|
||||
}
|
||||
srv.mu.Lock()
|
||||
srv.vms["mac-one"].windowReport.receivedAt = time.Now().Add(-2 * time.Second)
|
||||
srv.mu.Unlock()
|
||||
func() {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
vm := srv.vms[normalizeVMRegistryKey("mac-one")]
|
||||
if vm == nil {
|
||||
t.Fatal("registered VM was not found")
|
||||
}
|
||||
vm.windowReport.receivedAt = time.Now().Add(-2 * time.Second)
|
||||
}()
|
||||
if _, ok := srv.ActiveWindow("mac-one", time.Second); ok {
|
||||
t.Fatal("report older than maxAge was accepted")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user