mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-20 09:16:40 +00:00
[management] Add IPv6 overlay addressing and capability gating (#5698)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/netip"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -141,3 +142,25 @@ func TestFlags_IsEqual(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPeerCapabilities(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
capabilities []int32
|
||||
ipv6 bool
|
||||
srcPrefixes bool
|
||||
}{
|
||||
{"no capabilities", nil, false, false},
|
||||
{"only source prefixes", []int32{PeerCapabilitySourcePrefixes}, false, true},
|
||||
{"only ipv6", []int32{PeerCapabilityIPv6Overlay}, true, false},
|
||||
{"both", []int32{PeerCapabilitySourcePrefixes, PeerCapabilityIPv6Overlay}, true, true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
p := &Peer{Meta: PeerSystemMeta{Capabilities: tt.capabilities}}
|
||||
assert.Equal(t, tt.ipv6, p.SupportsIPv6())
|
||||
assert.Equal(t, tt.srcPrefixes, p.SupportsSourcePrefixes())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user