Skip to content

Commit

Permalink
Test: add noCleanup to TestServer stop
Browse files Browse the repository at this point in the history
  • Loading branch information
huikang committed Apr 7, 2023
1 parent 71c32b4 commit 9862a83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sdk/testutil/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,13 @@ func NewTestServerConfigT(t TestingTB, cb ServerConfigCallback) (*TestServer, er
// Stop stops the test Consul server, and removes the Consul data
// directory once we are done.
func (s *TestServer) Stop() error {
defer os.RemoveAll(s.tmpdir)
defer func() {
if noCleanup {
fmt.Println("skipping cleanup because TEST_NOCLEANUP was enabled")
} else {
os.RemoveAll(s.tmpdir)
}
}()

// There was no process
if s.cmd == nil {
Expand Down

0 comments on commit 9862a83

Please sign in to comment.