mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 16:26:38 +00:00
Send netmask from account network (#369)
* Send netmask from account network Added the GetPeerNetwork method to account manager Pass a copy of the network to the toPeerConfig function to retrieve the netmask from the network instead of constant updated methods and added test * check if the network is the same for 2 peers * Use expect with BeEquivalentTo
This commit is contained in:
@@ -422,6 +422,22 @@ var _ = Describe("Management service", func() {
|
||||
close(ipChannel)
|
||||
})
|
||||
})
|
||||
|
||||
Context("after login two peers", func() {
|
||||
Specify("then they receive the same network", func() {
|
||||
key, _ := wgtypes.GenerateKey()
|
||||
firstLogin := loginPeerWithValidSetupKey(serverPubKey, key, client)
|
||||
key, _ = wgtypes.GenerateKey()
|
||||
secondLogin := loginPeerWithValidSetupKey(serverPubKey, key, client)
|
||||
|
||||
_, firstLoginNetwork, err := net.ParseCIDR(firstLogin.GetPeerConfig().GetAddress())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
_, secondLoginNetwork, err := net.ParseCIDR(secondLogin.GetPeerConfig().GetAddress())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(secondLoginNetwork.String()).To(BeEquivalentTo(firstLoginNetwork.String()))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
func loginPeerWithValidSetupKey(serverPubKey wgtypes.Key, key wgtypes.Key, client mgmtProto.ManagementServiceClient) *mgmtProto.LoginResponse {
|
||||
|
||||
Reference in New Issue
Block a user