|
|
@ -26,6 +26,7 @@ import (
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"reflect"
|
|
|
|
"reflect"
|
|
|
|
|
|
|
|
"runtime"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"sync/atomic"
|
|
|
|
"sync/atomic"
|
|
|
@ -1007,6 +1008,11 @@ func TestUserMetrics(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
mustDirect(t, t.Logf, lc1, lc2)
|
|
|
|
mustDirect(t, t.Logf, lc1, lc2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wantRoutes := float64(3)
|
|
|
|
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
|
|
|
|
wantRoutes = 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Wait for the routes to be propagated to node 1 to ensure
|
|
|
|
// Wait for the routes to be propagated to node 1 to ensure
|
|
|
|
// that the metrics are up-to-date.
|
|
|
|
// that the metrics are up-to-date.
|
|
|
|
waitForCondition(t, "primary routes available for node1", 90*time.Second, func() bool {
|
|
|
|
waitForCondition(t, "primary routes available for node1", 90*time.Second, func() bool {
|
|
|
@ -1017,9 +1023,13 @@ func TestUserMetrics(t *testing.T) {
|
|
|
|
t.Logf("getting status: %s", err)
|
|
|
|
t.Logf("getting status: %s", err)
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t.Logf("status pr1: %v", status1.Self.PrimaryRoutes)
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
t.Logf("status r1: %v", status1.Self.AllowedIPs.AsSlice())
|
|
|
|
// Windows does not seem to support or report back routes when running in
|
|
|
|
return status1.Self.PrimaryRoutes != nil && status1.Self.PrimaryRoutes.Len() == 3
|
|
|
|
// userspace via tsnet. So, we skip this check on Windows.
|
|
|
|
|
|
|
|
// TODO(kradalby): Figure out if this is correct.
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return status1.Self.PrimaryRoutes != nil && status1.Self.PrimaryRoutes.Len() == int(wantRoutes)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 10 megabytes
|
|
|
|
// 10 megabytes
|
|
|
@ -1058,7 +1068,7 @@ func TestUserMetrics(t *testing.T) {
|
|
|
|
// - 192.0.3.0/24
|
|
|
|
// - 192.0.3.0/24
|
|
|
|
// - 192.0.5.1/32
|
|
|
|
// - 192.0.5.1/32
|
|
|
|
// - 0.0.0.0/0
|
|
|
|
// - 0.0.0.0/0
|
|
|
|
if got, want := parsedMetrics1["tailscaled_advertised_routes,"], 4.0; got != want {
|
|
|
|
if got, want := parsedMetrics1["tailscaled_advertised_routes,"], wantRoutes+1; got != want {
|
|
|
|
t.Errorf("metrics1, tailscaled_advertised_routes: got %v, want %v", got, want)
|
|
|
|
t.Errorf("metrics1, tailscaled_advertised_routes: got %v, want %v", got, want)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1066,7 +1076,7 @@ func TestUserMetrics(t *testing.T) {
|
|
|
|
// - 192.0.2.0/24
|
|
|
|
// - 192.0.2.0/24
|
|
|
|
// - 192.0.5.1/32
|
|
|
|
// - 192.0.5.1/32
|
|
|
|
// - 0.0.0.0/0
|
|
|
|
// - 0.0.0.0/0
|
|
|
|
if got, want := parsedMetrics1["tailscaled_approved_routes,"], 3.0; got != want {
|
|
|
|
if got, want := parsedMetrics1["tailscaled_approved_routes,"], wantRoutes; got != want {
|
|
|
|
t.Errorf("metrics1, tailscaled_approved_routes: got %v, want %v", got, want)
|
|
|
|
t.Errorf("metrics1, tailscaled_approved_routes: got %v, want %v", got, want)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1079,7 +1089,7 @@ func TestUserMetrics(t *testing.T) {
|
|
|
|
// - 192.0.2.0/24
|
|
|
|
// - 192.0.2.0/24
|
|
|
|
// - 192.0.5.1/32
|
|
|
|
// - 192.0.5.1/32
|
|
|
|
// - 0.0.0.0/0
|
|
|
|
// - 0.0.0.0/0
|
|
|
|
if got, want := parsedMetrics1["tailscaled_primary_routes,"], 3.0; got != want {
|
|
|
|
if got, want := parsedMetrics1["tailscaled_primary_routes,"], wantRoutes; got != want {
|
|
|
|
t.Errorf("metrics1, tailscaled_primary_routes: got %v, want %v", got, want)
|
|
|
|
t.Errorf("metrics1, tailscaled_primary_routes: got %v, want %v", got, want)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|