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

Function TestLoad

pkg/devspace/config/localcache/config_test.go:22–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestLoad(t *testing.T) {
23 testCases := []loadTestCase{
24 {
25 name: "no config file",
26 expectedConfig: &LocalCache{},
27 },
28 {
29 name: "load empty config file",
30 files: map[string]interface{}{
31 ".devspace/generated.yaml": struct{}{},
32 },
33 expectedConfig: &LocalCache{},
34 },
35 }
36
37 dir := t.TempDir()
38
39 wdBackup, err := os.Getwd()
40 if err != nil {
41 t.Fatalf("Error getting current working directory: %v", err)
42 }
43 err = os.Chdir(dir)
44 if err != nil {
45 t.Fatalf("Error changing working directory: %v", err)
46 }
47
48 defer func() {
49 //Delete temp folder
50 err = os.Chdir(wdBackup)
51 if err != nil {
52 t.Fatalf("Error changing dir back: %v", err)
53 }
54 }()
55
56 for _, testCase := range testCases {
57 testLoad(testCase, t)
58 }
59}
60
61func testLoad(testCase loadTestCase, t *testing.T) {
62 defer func() {

Callers

nothing calls this directly

Calls 2

testLoadFunction · 0.70
FatalfMethod · 0.45

Tested by

no test coverage detected