From 9e004d64178f5617ab95f2b0ca2df576fecb684b Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Thu, 4 Jun 2020 10:37:39 -0700 Subject: [PATCH] add hwlper to integraiotn test too --- test/integration/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/integration/main.go b/test/integration/main.go index 7a2865fd08..aa38029977 100644 --- a/test/integration/main.go +++ b/test/integration/main.go @@ -93,7 +93,14 @@ func KicDriver() bool { // NeedsPortForward returns access to endpoints with this driver needs port forwarding // (Docker on non-Linux platforms requires ports to be forwarded to 127.0.0.1) func NeedsPortForward() bool { - return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") + return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") || isMicrosoftWSL() +} + +// isMicrosoftWSL will return true if process is running in WSL in windows +// checking for WSL env var based on this https://github.com/microsoft/WSL/issues/423#issuecomment-608237689 +// also based on https://github.com/microsoft/vscode/blob/90a39ba0d49d75e9a4d7e62a6121ad946ecebc58/resources/win32/bin/code.sh#L24 +func isMicrosoftWSL() bool { + return os.Getenv("WSL_DISTRO_NAME") != "" || os.Getenv("WSLPATH") != "" || os.Getenv("WSLENV") != "" } // CanCleanup returns if cleanup is allowed