1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-12 23:32:50 -04:00

tailscale: fix flaky test

This commit is contained in:
bbedward
2026-05-12 09:36:44 -04:00
parent 4bc62cc6ec
commit 7a566e1088
+2 -11
View File
@@ -100,7 +100,6 @@ func runningStatus() *ipnstate.Status {
func TestWatchLoop_StateChange(t *testing.T) {
stateVal := ipn.Running
statusCalled := make(chan struct{}, 4)
var watchCount int32
client := &mockClient{
@@ -115,10 +114,6 @@ func TestWatchLoop_StateChange(t *testing.T) {
return newMockWatcher(ctx, nil, nil), nil
},
statusFn: func(ctx context.Context) (*ipnstate.Status, error) {
select {
case statusCalled <- struct{}{}:
default:
}
return runningStatus(), nil
},
}
@@ -127,13 +122,9 @@ func TestWatchLoop_StateChange(t *testing.T) {
defer m.Close()
require.Eventually(t, func() bool {
return len(statusCalled) > 0
s := m.GetState()
return s.Connected && s.BackendState == "Running" && s.Self.Hostname == "cachyos"
}, 2*time.Second, 10*time.Millisecond)
state := m.GetState()
assert.True(t, state.Connected)
assert.Equal(t, "Running", state.BackendState)
assert.Equal(t, "cachyos", state.Self.Hostname)
}
func TestWatchLoop_CoalescesNotifies(t *testing.T) {