tailscale/net/tstun/mtu_test.go
Val 6cc5b272d8 Revert "wgengine,net,ipn,disco: split up and define different types of MTU"
This reverts commit 059051c58a.

Signed-off-by: Val <valerie@tailscale.com>
2023-09-22 10:56:43 -07:00

29 lines
616 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package tstun
import (
"os"
"testing"
)
func TestDefaultMTU(t *testing.T) {
orig := os.Getenv("TS_DEBUG_MTU")
defer os.Setenv("TS_DEBUG_MTU", orig)
os.Setenv("TS_DEBUG_MTU", "")
if DefaultMTU() != 1280 {
t.Errorf("DefaultMTU() = %d, want 1280", DefaultMTU())
}
os.Setenv("TS_DEBUG_MTU", "9000")
if DefaultMTU() != 9000 {
t.Errorf("DefaultMTU() = %d, want 9000", DefaultMTU())
}
os.Setenv("TS_DEBUG_MTU", "123456789")
if DefaultMTU() != maxMTU {
t.Errorf("DefaultMTU() = %d, want %d", DefaultMTU(), maxMTU)
}
}