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

Function TestLoad

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

Source from the content-addressed store, hash-verified

149}
150
151func TestLoad(t *testing.T) {
152 testCases := []*loadTestCase{
153 {
154 name: "Get from custom config file with profile",
155 configPath: "custom.yaml",
156 options: ConfigOptions{},
157 files: map[string]interface{}{
158 "custom.yaml": latest.Config{
159 Version: latest.Version,
160 Profiles: []*latest.ProfileConfig{
161 {
162 Name: "active",
163 },
164 },
165 },
166 },
167 returnedGenerated: localcache.LocalCache{},
168 withProfile: true,
169 expectedConfig: &latest.Config{
170 Version: latest.Version,
171 Name: "devspace",
172 Dev: latest.NewRaw().Dev,
173 },
174 },
175 {
176 name: "Get from default file without profile",
177 options: ConfigOptions{},
178 files: map[string]interface{}{
179 "devspace.yaml": latest.Config{
180 Version: latest.Version,
181 Name: "devspace",
182 },
183 },
184 expectedConfig: &latest.Config{
185 Version: latest.Version,
186 Name: "devspace",
187 Dev: latest.NewRaw().Dev,
188 },
189 },
190 }
191
192 dir := t.TempDir()
193
194 wdBackup, err := os.Getwd()
195 if err != nil {
196 t.Fatalf("Error getting current working directory: %v", err)
197 }
198 err = os.Chdir(dir)
199 if err != nil {
200 t.Fatalf("Error changing working directory: %v", err)
201 }
202
203 defer func() {
204 //Delete temp folder
205 err = os.Chdir(wdBackup)
206 if err != nil {
207 t.Fatalf("Error changing dir back: %v", err)
208 }

Callers

nothing calls this directly

Calls 3

NewRawFunction · 0.92
testLoadFunction · 0.70
FatalfMethod · 0.45

Tested by

no test coverage detected