mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-23 19:21:23 +02:00
Add active peers count per OS (#526)
* Add active peers count per OS * increase iface tests timeout
This commit is contained in:
parent
5ed61700ff
commit
9a4c9aa286
@ -89,7 +89,6 @@ func getIfaceAddrs(ifaceName string) ([]net.Addr, error) {
|
|||||||
return addrs, nil
|
return addrs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
func Test_CreateInterface(t *testing.T) {
|
func Test_CreateInterface(t *testing.T) {
|
||||||
ifaceName := fmt.Sprintf("utun%d", WgIntNumber+1)
|
ifaceName := fmt.Sprintf("utun%d", WgIntNumber+1)
|
||||||
wgIP := "10.99.99.1/32"
|
wgIP := "10.99.99.1/32"
|
||||||
@ -369,8 +368,8 @@ func Test_ConnectPeers(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
// todo: investigate why in some tests execution we need 30s
|
||||||
timeout := 10 * time.Second
|
timeout := 30 * time.Second
|
||||||
timeoutChannel := time.After(timeout)
|
timeoutChannel := time.After(timeout)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@ -188,13 +188,17 @@ func (w *Worker) generateProperties() properties {
|
|||||||
userPeers++
|
userPeers++
|
||||||
}
|
}
|
||||||
|
|
||||||
_, connected := connections[peer.Key]
|
|
||||||
if connected || peer.Status.LastSeen.After(w.lastRun) {
|
|
||||||
activePeersLastDay++
|
|
||||||
}
|
|
||||||
osKey := strings.ToLower(fmt.Sprintf("peer_os_%s", peer.Meta.GoOS))
|
osKey := strings.ToLower(fmt.Sprintf("peer_os_%s", peer.Meta.GoOS))
|
||||||
osCount := osPeers[osKey]
|
osCount := osPeers[osKey]
|
||||||
osPeers[osKey] = osCount + 1
|
osPeers[osKey] = osCount + 1
|
||||||
|
|
||||||
|
_, connected := connections[peer.Key]
|
||||||
|
if connected || peer.Status.LastSeen.After(w.lastRun) {
|
||||||
|
activePeersLastDay++
|
||||||
|
osActiveKey := osKey + "_active"
|
||||||
|
osActiveCount := osPeers[osActiveKey]
|
||||||
|
osPeers[osActiveKey] = osActiveCount + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,5 +283,4 @@ func createPostRequest(ctx context.Context, endpoint string, payloadStr string)
|
|||||||
req.Header.Add("content-type", "application/json")
|
req.Header.Add("content-type", "application/json")
|
||||||
|
|
||||||
return req, nil
|
return req, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user