@@ -42,6 +42,20 @@ var _ = DevSpaceDescribe("config", func() {
4242 framework .ExpectNoError (err )
4343 })
4444
45+ ginkgo .It ("should convert correctly" , func () {
46+ tempDir , err := framework .CopyToTempDir ("tests/config/testdata/convert" )
47+ framework .ExpectNoError (err )
48+ defer framework .CleanupTempDir (initialDir , tempDir )
49+
50+ // reload it
51+ config , _ , err := framework .LoadConfigWithOptions (f , kubeClient .Client (), "devspace.yaml" , & loader.ConfigOptions {})
52+ framework .ExpectNoError (err )
53+
54+ framework .ExpectEqual (len (config .Config ().Dev ), 1 )
55+ framework .ExpectEqual (config .Config ().Dev ["sync-0" ].Container , "test" )
56+ framework .ExpectEqual (config .Config ().Dev ["sync-0" ].Terminal .Command , "test" )
57+ })
58+
4559 ginkgo .It ("should resolve runtime environment variables correctly" , func () {
4660 tempDir , err := framework .CopyToTempDir ("tests/config/testdata/runtime-variables" )
4761 framework .ExpectNoError (err )
@@ -251,6 +265,64 @@ var _ = DevSpaceDescribe("config", func() {
251265 // check profile was loaded
252266 framework .ExpectEqual (len (config .Config ().Images ), 1 )
253267 framework .ExpectEqual (len (config .Config ().Deployments ), 2 )
268+
269+ // reload it with different profile
270+ config , _ , err = framework .LoadConfigWithOptions (f , kubeClient .Client (), "devspace.yaml" , & loader.ConfigOptions {Profiles : []string {"merge-deployments" }})
271+ framework .ExpectNoError (err )
272+
273+ // check profile was loaded
274+ framework .ExpectEqual (len (config .Config ().Images ), 1 )
275+ framework .ExpectEqual (len (config .Config ().Deployments ), 1 )
276+ framework .ExpectEqual (config .Config ().Deployments ["test456" ].Name , "test456" )
277+ framework .ExpectEqual (len (config .Config ().Deployments ["test456" ].Kubectl .Manifests ), 2 )
278+ framework .ExpectEqual (config .Config ().Deployments ["test456" ].Kubectl .Manifests [0 ], "test" )
279+ framework .ExpectEqual (config .Config ().Deployments ["test456" ].Kubectl .Manifests [1 ], "test.yaml" )
280+
281+ // load new config
282+ config , _ , err = framework .LoadConfigWithOptions (f , kubeClient .Client (), "devspace_new.yaml" , & loader.ConfigOptions {Profiles : []string {"merge-deployments" }})
283+ framework .ExpectNoError (err )
284+
285+ // check profile was loaded
286+ framework .ExpectEqual (len (config .Config ().Images ), 1 )
287+ framework .ExpectEqual (len (config .Config ().Deployments ), 2 )
288+
289+ framework .ExpectEqual (config .Config ().Deployments ["test" ].Name , "test" )
290+ framework .ExpectEqual (len (config .Config ().Deployments ["test" ].Kubectl .Manifests ), 1 )
291+ framework .ExpectEqual (config .Config ().Deployments ["test" ].Kubectl .Manifests [0 ], "test" )
292+
293+ framework .ExpectEqual (config .Config ().Deployments ["test456" ].Name , "test456" )
294+ framework .ExpectEqual (len (config .Config ().Deployments ["test456" ].Kubectl .Manifests ), 2 )
295+ framework .ExpectEqual (config .Config ().Deployments ["test456" ].Kubectl .Manifests [0 ], "test" )
296+ framework .ExpectEqual (config .Config ().Deployments ["test456" ].Kubectl .Manifests [1 ], "test.yaml" )
297+
298+ // load new config
299+ config , _ , err = framework .LoadConfigWithOptions (f , kubeClient .Client (), "devspace_new.yaml" , & loader.ConfigOptions {Profiles : []string {"add-deployment" }})
300+ framework .ExpectNoError (err )
301+
302+ // check profile was loaded
303+ framework .ExpectEqual (len (config .Config ().Images ), 1 )
304+ framework .ExpectEqual (len (config .Config ().Deployments ), 2 )
305+
306+ framework .ExpectEqual (config .Config ().Deployments ["test" ].Name , "test" )
307+ framework .ExpectEqual (len (config .Config ().Deployments ["test" ].Kubectl .Manifests ), 1 )
308+ framework .ExpectEqual (config .Config ().Deployments ["test" ].Kubectl .Manifests [0 ], "test" )
309+
310+ framework .ExpectEqual (config .Config ().Deployments ["test678" ].Name , "test678" )
311+ framework .ExpectEqual (len (config .Config ().Deployments ["test678" ].Kubectl .Manifests ), 1 )
312+ framework .ExpectEqual (config .Config ().Deployments ["test678" ].Kubectl .Manifests [0 ], "test" )
313+
314+ // load new config
315+ config , _ , err = framework .LoadConfigWithOptions (f , kubeClient .Client (), "devspace_new.yaml" , & loader.ConfigOptions {Profiles : []string {"replace-manifests" }})
316+ framework .ExpectNoError (err )
317+
318+ // check profile was loaded
319+ framework .ExpectEqual (len (config .Config ().Images ), 1 )
320+ framework .ExpectEqual (len (config .Config ().Deployments ), 1 )
321+
322+ framework .ExpectEqual (config .Config ().Deployments ["test123" ].Name , "test123" )
323+ framework .ExpectEqual (len (config .Config ().Deployments ["test123" ].Kubectl .Manifests ), 2 )
324+ framework .ExpectEqual (config .Config ().Deployments ["test123" ].Kubectl .Manifests [0 ], "test123.yaml" )
325+ framework .ExpectEqual (config .Config ().Deployments ["test123" ].Kubectl .Manifests [1 ], "test" )
254326 })
255327
256328 ginkgo .It ("should auto activate profile using single environment variable" , func () {
0 commit comments