Add testing environment helpers

This commit is contained in:
Shelikhoo 2023-12-12 14:43:56 +00:00 committed by WofWca
parent 457c4fbf15
commit 93d303b47b
2 changed files with 11 additions and 1 deletions

View file

@ -271,7 +271,11 @@ func main() {
switch methodName {
case "snowflake":
// TODO: Be able to recover when SOCKS dies.
ln, err := pt.ListenSocks("tcp", "127.0.0.1:0")
listenAddr := "127.0.0.1:0"
if forcedListenAddr := os.Getenv("SNOWFLAKE_TEST_FORCELISTENADDR"); forcedListenAddr != "" {
listenAddr = forcedListenAddr
}
ln, err := pt.ListenSocks("tcp", listenAddr)
if err != nil {
pt.CmethodError(methodName, err.Error())
break