From: Simon Ruderich Date: Mon, 5 Apr 2021 08:47:40 +0000 (+0200) Subject: config: remove unnecessary os.Chdir in test X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=641203fda8f7da72c74562c9dc910ca108116f11;p=safcm%2Fsafcm.git config: remove unnecessary os.Chdir in test --- diff --git a/cmd/safcm/config/groups_test.go b/cmd/safcm/config/groups_test.go index b2bf5ec..cf6cd6e 100644 --- a/cmd/safcm/config/groups_test.go +++ b/cmd/safcm/config/groups_test.go @@ -18,6 +18,7 @@ package config import ( "fmt" "os" + "path/filepath" "reflect" "testing" @@ -186,7 +187,7 @@ func TestLoadGroups(t *testing.T) { for _, tc := range tests { t.Run(tc.path, func(t *testing.T) { - err := os.Chdir(tc.path) + err := os.Chdir(filepath.Join(cwd, tc.path)) if err != nil { t.Fatal(err) } @@ -201,11 +202,6 @@ func TestLoadGroups(t *testing.T) { t.Errorf("err = %#v, want %#v", err, tc.expErr) } - - err = os.Chdir(cwd) - if err != nil { - t.Fatal(err) - } }) } }