mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-21 08:57:48 +02:00
test: wait for hub system status in agent WebSocket integration test
This commit is contained in:
@@ -978,11 +978,18 @@ func TestAgentWebSocketIntegration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify system status
|
// A connected WebSocket does not mean the hub has finished verifying
|
||||||
updatedSystemRecord, err := testApp.FindRecordById("systems", systemRecord.Id)
|
// the agent and updating the system. Wait for the database state rather
|
||||||
require.NoError(t, err)
|
// than assuming that work completes within a fixed sleep under load.
|
||||||
status := updatedSystemRecord.GetString("status")
|
var status string
|
||||||
assert.Equal(t, tc.expectSystemStatus, status, "System status should match expected value")
|
require.EventuallyWithT(t, func(c *assert.CollectT) {
|
||||||
|
updatedSystemRecord, err := testApp.FindRecordById("systems", systemRecord.Id)
|
||||||
|
if !assert.NoError(c, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
status = updatedSystemRecord.GetString("status")
|
||||||
|
assert.Equal(c, tc.expectSystemStatus, status, "System status should match expected value")
|
||||||
|
}, 5*time.Second, 20*time.Millisecond)
|
||||||
|
|
||||||
t.Logf("%s - System status: %s, Fingerprint: %s", tc.description, status, finalFingerprint)
|
t.Logf("%s - System status: %s, Fingerprint: %s", tc.description, status, finalFingerprint)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user