MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestGetProfiles

Function TestGetProfiles

pkg/devspace/config/loader/loader_test.go:382–431  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

380}
381
382func TestGetProfiles(t *testing.T) {
383 testCases := []getProfilesTestCase{
384 {
385 name: "Empty file",
386 files: map[string]interface{}{
387 "devspace.yaml": map[string]interface{}{
388 "version": "v1beta9",
389 },
390 },
391 },
392 {
393 name: "Parse several profiles",
394 configPath: "custom.yaml",
395 files: map[string]interface{}{
396 "custom.yaml": map[string]interface{}{
397 "version": "v1beta9",
398 "profiles": []interface{}{
399 map[string]interface{}{
400 "name": "myprofile",
401 },
402 },
403 },
404 },
405 expectedProfiles: []string{"myprofile"},
406 },
407 }
408
409 dir := t.TempDir()
410
411 wdBackup, err := os.Getwd()
412 if err != nil {
413 t.Fatalf("Error getting current working directory: %v", err)
414 }
415 err = os.Chdir(dir)
416 if err != nil {
417 t.Fatalf("Error changing working directory: %v", err)
418 }
419
420 defer func() {
421 //Delete temp folder
422 err = os.Chdir(wdBackup)
423 if err != nil {
424 t.Fatalf("Error changing dir back: %v", err)
425 }
426 }()
427
428 for _, testCase := range testCases {
429 testGetProfiles(testCase, t)
430 }
431}
432
433func testGetProfiles(testCase getProfilesTestCase, t *testing.T) {
434 defer func() {

Callers

nothing calls this directly

Calls 2

testGetProfilesFunction · 0.85
FatalfMethod · 0.45

Tested by

no test coverage detected