|
|
@ -10,14 +10,14 @@ import (
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tailscale.com/tstest"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// test the specific /proc/net/route path as found on Google Cloud Run instances
|
|
|
|
// test the specific /proc/net/route path as found on Google Cloud Run instances
|
|
|
|
func TestGoogleCloudRunDefaultRouteInterface(t *testing.T) {
|
|
|
|
func TestGoogleCloudRunDefaultRouteInterface(t *testing.T) {
|
|
|
|
dir := t.TempDir()
|
|
|
|
dir := t.TempDir()
|
|
|
|
savedProcNetRoutePath := procNetRoutePath
|
|
|
|
tstest.Replace(t, &procNetRoutePath, filepath.Join(dir, "CloudRun"))
|
|
|
|
defer func() { procNetRoutePath = savedProcNetRoutePath }()
|
|
|
|
|
|
|
|
procNetRoutePath = filepath.Join(dir, "CloudRun")
|
|
|
|
|
|
|
|
buf := []byte("Iface\tDestination\tGateway\tFlags\tRefCnt\tUse\tMetric\tMask\tMTU\tWindow\tIRTT\n" +
|
|
|
|
buf := []byte("Iface\tDestination\tGateway\tFlags\tRefCnt\tUse\tMetric\tMask\tMTU\tWindow\tIRTT\n" +
|
|
|
|
"eth0\t8008FEA9\t00000000\t0001\t0\t0\t0\t01FFFFFF\t0\t0\t0\n" +
|
|
|
|
"eth0\t8008FEA9\t00000000\t0001\t0\t0\t0\t01FFFFFF\t0\t0\t0\n" +
|
|
|
|
"eth1\t00000000\t00000000\t0001\t0\t0\t0\t00000000\t0\t0\t0\n")
|
|
|
|
"eth1\t00000000\t00000000\t0001\t0\t0\t0\t00000000\t0\t0\t0\n")
|
|
|
@ -39,9 +39,7 @@ func TestGoogleCloudRunDefaultRouteInterface(t *testing.T) {
|
|
|
|
// size can be handled.
|
|
|
|
// size can be handled.
|
|
|
|
func TestExtremelyLongProcNetRoute(t *testing.T) {
|
|
|
|
func TestExtremelyLongProcNetRoute(t *testing.T) {
|
|
|
|
dir := t.TempDir()
|
|
|
|
dir := t.TempDir()
|
|
|
|
savedProcNetRoutePath := procNetRoutePath
|
|
|
|
tstest.Replace(t, &procNetRoutePath, filepath.Join(dir, "VeryLong"))
|
|
|
|
defer func() { procNetRoutePath = savedProcNetRoutePath }()
|
|
|
|
|
|
|
|
procNetRoutePath = filepath.Join(dir, "VeryLong")
|
|
|
|
|
|
|
|
f, err := os.Create(procNetRoutePath)
|
|
|
|
f, err := os.Create(procNetRoutePath)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
t.Fatal(err)
|
|
|
@ -76,9 +74,7 @@ func TestExtremelyLongProcNetRoute(t *testing.T) {
|
|
|
|
// test the specific /proc/net/route path as found on AWS App Runner instances
|
|
|
|
// test the specific /proc/net/route path as found on AWS App Runner instances
|
|
|
|
func TestAwsAppRunnerDefaultRouteInterface(t *testing.T) {
|
|
|
|
func TestAwsAppRunnerDefaultRouteInterface(t *testing.T) {
|
|
|
|
dir := t.TempDir()
|
|
|
|
dir := t.TempDir()
|
|
|
|
savedProcNetRoutePath := procNetRoutePath
|
|
|
|
tstest.Replace(t, &procNetRoutePath, filepath.Join(dir, "CloudRun"))
|
|
|
|
defer func() { procNetRoutePath = savedProcNetRoutePath }()
|
|
|
|
|
|
|
|
procNetRoutePath = filepath.Join(dir, "CloudRun")
|
|
|
|
|
|
|
|
buf := []byte("Iface\tDestination\tGateway\tFlags\tRefCnt\tUse\tMetric\tMask\tMTU\tWindow\tIRTT\n" +
|
|
|
|
buf := []byte("Iface\tDestination\tGateway\tFlags\tRefCnt\tUse\tMetric\tMask\tMTU\tWindow\tIRTT\n" +
|
|
|
|
"eth0\t00000000\tF9AFFEA9\t0003\t0\t0\t0\t00000000\t0\t0\t0\n" +
|
|
|
|
"eth0\t00000000\tF9AFFEA9\t0003\t0\t0\t0\t00000000\t0\t0\t0\n" +
|
|
|
|
"*\tFEA9FEA9\t00000000\t0005\t0\t0\t0\tFFFFFFFF\t0\t0\t0\n" +
|
|
|
|
"*\tFEA9FEA9\t00000000\t0005\t0\t0\t0\tFFFFFFFF\t0\t0\t0\n" +
|
|
|
|