-
-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3438 from telepresenceio/thallgren/restore-dns-se…
…arch The DNS search path on Windows is now restored when Telepresence quits
- Loading branch information
Showing
11 changed files
with
152 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package integration_test | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
|
||
"golang.org/x/sys/windows/registry" | ||
|
||
"github.com/telepresenceio/telepresence/v2/integration_test/itest" | ||
) | ||
|
||
func (s *notConnectedSuite) getGlobalSearchList() []string { | ||
const ( | ||
tcpParamKey = `System\CurrentControlSet\Services\Tcpip\Parameters` | ||
searchListKey = `SearchList` | ||
) | ||
rk, err := registry.OpenKey(registry.LOCAL_MACHINE, tcpParamKey, registry.QUERY_VALUE) | ||
if os.IsNotExist(err) { | ||
err = nil | ||
} | ||
s.Require().NoError(err) | ||
defer rk.Close() | ||
csv, _, err := rk.GetStringValue(searchListKey) | ||
if os.IsNotExist(err) { | ||
err = nil | ||
} | ||
s.Require().NoError(err) | ||
return strings.Split(csv, ",") | ||
} | ||
|
||
func (s *notConnectedSuite) Test_DNSSearchRestored() { | ||
beforeConnect := s.getGlobalSearchList() | ||
ctx := s.Context() | ||
s.TelepresenceConnect(ctx) | ||
afterConnect := s.getGlobalSearchList() | ||
s.Assert().NotEqual(beforeConnect, afterConnect) | ||
itest.TelepresenceQuitOk(ctx) | ||
afterQuit := s.getGlobalSearchList() | ||
s.Assert().Equal(beforeConnect, afterQuit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.