From 5df8a2396aa8bc034c4c1aed3c47090111c142a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= Date: Mon, 20 Nov 2023 14:17:19 +0100 Subject: [PATCH] Minor change --- test/test-cluster.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/test-cluster.go b/test/test-cluster.go index 05e5dfc..071fb19 100644 --- a/test/test-cluster.go +++ b/test/test-cluster.go @@ -7,8 +7,8 @@ import ( ) type testCluster struct { - path string - originalWorkDir string + path string + origWorkDir string } func newTestCluster(path string) (*testCluster, error) { @@ -18,15 +18,16 @@ func newTestCluster(path string) (*testCluster, error) { } if path == "" { - parentDir := filepath.Dir(workDir) - if err := os.Chdir(parentDir); err != nil { - return nil, err - } + path = filepath.Dir(workDir) + } + + if err := os.Chdir(path); err != nil { + return nil, err } return &testCluster{ - path: path, - originalWorkDir: workDir, + path: path, + origWorkDir: workDir, }, nil } @@ -39,5 +40,5 @@ func (t *testCluster) stop() ([]byte, error) { } func (t *testCluster) reset() error { - return os.Chdir(t.originalWorkDir) + return os.Chdir(t.origWorkDir) }