mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
netns_linux: remove special handling for tests.
With netns handling localhost now, existing tests no longer need special handling. The tests set up their connections to localhost, and the connections work without fuss. Remove the special handling for tests. Also remove the hostinfo.TestCase support, since this was the only use of it. It can be added back later if really needed, but it would be better to try to make tests work without special cases. Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:

committed by
Denton Gentry

parent
d2480fd508
commit
e28bc49e5f
@@ -9,7 +9,6 @@
|
||||
package hostinfo
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
@@ -29,7 +28,6 @@ const (
|
||||
Heroku = EnvType("hr")
|
||||
AzureAppService = EnvType("az")
|
||||
AWSFargate = EnvType("fg")
|
||||
TestCase = EnvType("tc")
|
||||
)
|
||||
|
||||
var envType atomic.Value // of EnvType
|
||||
@@ -44,11 +42,6 @@ func GetEnvType() EnvType {
|
||||
}
|
||||
|
||||
func getEnvType() EnvType {
|
||||
// inTestCase needs to go first. If running tests in a container, we want
|
||||
// the environment to be TestCase not the type of container.
|
||||
if inTestCase() {
|
||||
return TestCase
|
||||
}
|
||||
if inKnative() {
|
||||
return KNative
|
||||
}
|
||||
@@ -91,13 +84,6 @@ func InContainer() bool {
|
||||
return ret
|
||||
}
|
||||
|
||||
func inTestCase() bool {
|
||||
if flag.CommandLine.Lookup("test.v") != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func inKnative() bool {
|
||||
// https://cloud.google.com/run/docs/reference/container-contract#env-vars
|
||||
if os.Getenv("K_REVISION") != "" && os.Getenv("K_CONFIGURATION") != "" &&
|
||||
|
Reference in New Issue
Block a user