mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-21 06:09:07 +02:00
Move the Status recorder and its state types out of the peer package into client/internal/peer/status, split by struct across recorder.go, peer_state.go, full_status.go, events.go, notifier.go and route.go instead of one 1600-line file. Rename the type Status -> Recorder (NewRecorder already implied it; avoids status.Status stutter). Split conn_status.go: the ConnStatus type and its constants move to the status package, connStatusInputs stays with the peer event loop. The peer package references the status package directly; a transitional status_alias.go re-exports the moved symbols for the ~50 external callers still using peer.Status/State/ConnStatus, to be removed once they are migrated.
28 lines
526 B
Go
28 lines
526 B
Go
package status
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConnStatus_String(t *testing.T) {
|
|
|
|
tables := []struct {
|
|
name string
|
|
status ConnStatus
|
|
want string
|
|
}{
|
|
{"StatusConnected", StatusConnected, "Connected"},
|
|
{"StatusIdle", StatusIdle, "Idle"},
|
|
{"StatusConnecting", StatusConnecting, "Connecting"},
|
|
}
|
|
|
|
for _, table := range tables {
|
|
t.Run(table.name, func(t *testing.T) {
|
|
got := table.status.String()
|
|
assert.Equal(t, got, table.want, "they should be equal")
|
|
})
|
|
}
|
|
}
|