23 lines
913 B
Go
23 lines
913 B
Go
package transport
|
|
|
|
import "testing"
|
|
|
|
// TestHeartbeatWaitExceedsInterval guards the edge-side invariant. Even though
|
|
// the library now self-heals stale wait timers (proto-socket base_client.go,
|
|
// wait-timer state check), keeping wait > interval gives the peer's next
|
|
// heartbeat an extra chance to clear the stray timer before it fires, which
|
|
// keeps idle traffic stable on slow links. Mirror of the node-side test.
|
|
func TestHeartbeatWaitExceedsInterval(t *testing.T) {
|
|
if heartbeatWaitSec <= heartbeatIntervalSec {
|
|
t.Fatalf("heartbeatWaitSec (%d) must exceed heartbeatIntervalSec (%d)", heartbeatWaitSec, heartbeatIntervalSec)
|
|
}
|
|
}
|
|
|
|
func TestHeartbeatUsesLowLatencyNodeLivenessProfile(t *testing.T) {
|
|
if heartbeatIntervalSec != 2 {
|
|
t.Fatalf("heartbeatIntervalSec: got %d want 2", heartbeatIntervalSec)
|
|
}
|
|
if heartbeatWaitSec != 5 {
|
|
t.Fatalf("heartbeatWaitSec: got %d want 5", heartbeatWaitSec)
|
|
}
|
|
}
|