]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
config: remove unnecessary os.Chdir in test
authorSimon Ruderich <simon@ruderich.org>
Mon, 5 Apr 2021 08:47:40 +0000 (10:47 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 5 Apr 2021 08:47:40 +0000 (10:47 +0200)
cmd/safcm/config/groups_test.go

index b2bf5ec41d9027ecf39ebc6783dec321a936d885..cf6cd6e088cd48d3789fb2f618f903eb1e420dcc 100644 (file)
@@ -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)
-                       }
                })
        }
 }