mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
ipn/localipn: introduce logs for tailfs (#11496)
This change introduces some basic logging into the access and share pathways for tailfs. Updates tailscale/corp#17818 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
This commit is contained in:

committed by
GitHub

parent
4cbef20569
commit
acb611f034
@@ -2507,3 +2507,29 @@ func TestValidPopBrowserURL(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRoundTraffic(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
bytes int64
|
||||
want float64
|
||||
}{
|
||||
{name: "under 5 bytes", bytes: 4, want: 4},
|
||||
{name: "under 1000 bytes", bytes: 987, want: 990},
|
||||
{name: "under 10_000 bytes", bytes: 8875, want: 8900},
|
||||
{name: "under 100_000 bytes", bytes: 77777, want: 78000},
|
||||
{name: "under 1_000_000 bytes", bytes: 666523, want: 670000},
|
||||
{name: "under 10_000_000 bytes", bytes: 22556677, want: 23000000},
|
||||
{name: "under 1_000_000_000 bytes", bytes: 1234234234, want: 1200000000},
|
||||
{name: "under 1_000_000_000 bytes", bytes: 123423423499, want: 123400000000},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if result := roundTraffic(tt.bytes); result != tt.want {
|
||||
t.Errorf("unexpected rounding got %v want %v", result, tt.want)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user