Skip to content

Commit caae881

Browse files
committed
Refactor TestExportProfile
1 parent 83a10c2 commit caae881

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

internal/pkg/config/profiles_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,21 @@ func TestExportProfile(t *testing.T) {
199199
}(testDir)
200200
})
201201

202-
defaultConfigFolderPath = filepath.Join(testDir, "config")
203-
err = os.Mkdir(defaultConfigFolderPath, 0o750)
202+
// Create test config directory
203+
testConfigFolderPath := filepath.Join(testDir, "config")
204+
initConfig(testConfigFolderPath)
205+
err = Write()
204206
if err != nil {
205-
t.Fatal(err)
207+
t.Fatalf("could not write profile, %v", err)
206208
}
207209

208210
// Create prerequisite profile
209211
p := print.NewPrinter()
210212
profileName := "export-profile-test"
211-
err = CreateProfile(p, profileName, true, true)
213+
err = CreateProfile(p, profileName, true, false)
212214
if err != nil {
213215
t.Fatalf("could not create prerequisite profile, %v", err)
214216
}
215-
initConfig(defaultConfigFolderPath)
216-
err = Write()
217-
if err != nil {
218-
t.Fatalf("could not write profile, %v", err)
219-
}
220217
t.Cleanup(func() {
221218
func(p *print.Printer, profile string) {
222219
err := DeleteProfile(p, profile)

0 commit comments

Comments
 (0)