@@ -75,6 +75,8 @@ var _ = DevSpaceDescribe("pipelines", func() {
7575 framework .ExpectLocalFileContentsImmediately ("other.txt" , "test\n " )
7676 framework .ExpectLocalFileContentsImmediately ("other2.txt" , "false\n " )
7777 framework .ExpectLocalFileContentsImmediately ("other3.txt" , "true\n " )
78+ framework .ExpectLocalFileContentsImmediately ("other4-0.txt" , "one\n " )
79+ framework .ExpectLocalFileContentsImmediately ("other4-1.txt" , "two\n " )
7880 framework .ExpectLocalFileContentsImmediately ("other-profile.txt" , "profile1\n " )
7981 framework .ExpectLocalFileContentsImmediately ("dep1-test.txt" , "test\n " )
8082 framework .ExpectLocalFileContentsImmediately ("dep1-test2.txt" , "true\n " )
@@ -85,6 +87,143 @@ var _ = DevSpaceDescribe("pipelines", func() {
8587 framework .ExpectLocalFileContentsImmediately ("dep1-other-profile.txt" , "profile1\n " )
8688 })
8789
90+ ginkgo .It ("should resolve pipeline override array flags" , func () {
91+ tempDir , err := framework .CopyToTempDir ("tests/pipelines/testdata/flags" )
92+ framework .ExpectNoError (err )
93+ defer framework .CleanupTempDir (initialDir , tempDir )
94+
95+ ns , err := kubeClient .CreateNamespace ("pipelines" )
96+ framework .ExpectNoError (err )
97+ defer framework .ExpectDeleteNamespace (kubeClient , ns )
98+
99+ rootCmd := cmd .NewRootCmd (f )
100+ persistentFlags := rootCmd .PersistentFlags ()
101+ globalFlags := flags .SetGlobalFlags (persistentFlags )
102+ globalFlags .NoWarn = true
103+ globalFlags .Namespace = ns
104+ globalFlags .Profiles = []string {"profile1" }
105+
106+ cmdCtx := values .WithCommandFlags (context .Background (), globalFlags .Flags )
107+ cmdCtx = values .WithFlagsMap (cmdCtx , map [string ]string {
108+ "other" : "test" ,
109+ "other2" : "false" ,
110+ "other3" : "true" ,
111+ "other4" : "three four" ,
112+ })
113+
114+ devCmd := & cmd.RunPipelineCmd {
115+ GlobalFlags : globalFlags ,
116+ Pipeline : "other" ,
117+ Ctx : cmdCtx ,
118+ }
119+ err = devCmd .RunDefault (f )
120+ framework .ExpectNoError (err )
121+
122+ framework .ExpectLocalFileContentsImmediately ("other.txt" , "test\n " )
123+ framework .ExpectLocalFileContentsImmediately ("other2.txt" , "false\n " )
124+ framework .ExpectLocalFileContentsImmediately ("other3.txt" , "true\n " )
125+ framework .ExpectLocalFileContentsImmediately ("other-profile.txt" , "profile1\n " )
126+ framework .ExpectLocalFileContentsImmediately ("other4-0.txt" , "three\n " )
127+ framework .ExpectLocalFileContentsImmediately ("other4-1.txt" , "four\n " )
128+ })
129+
130+ ginkgo .It ("should resolve pipeline override with --set-flags" , func () {
131+ tempDir , err := framework .CopyToTempDir ("tests/pipelines/testdata/flags" )
132+ framework .ExpectNoError (err )
133+ defer framework .CleanupTempDir (initialDir , tempDir )
134+
135+ ns , err := kubeClient .CreateNamespace ("pipelines" )
136+ framework .ExpectNoError (err )
137+ defer framework .ExpectDeleteNamespace (kubeClient , ns )
138+
139+ rootCmd := cmd .NewRootCmd (f )
140+ persistentFlags := rootCmd .PersistentFlags ()
141+ globalFlags := flags .SetGlobalFlags (persistentFlags )
142+ globalFlags .NoWarn = true
143+ globalFlags .Namespace = ns
144+ globalFlags .Profiles = []string {"profile1" }
145+
146+ cmdCtx := values .WithCommandFlags (context .Background (), globalFlags .Flags )
147+ cmdCtx = values .WithFlagsMap (cmdCtx , map [string ]string {})
148+
149+ devCmd := & cmd.RunPipelineCmd {
150+ GlobalFlags : globalFlags ,
151+ Pipeline : "other-override" ,
152+ Ctx : cmdCtx ,
153+ }
154+ err = devCmd .RunDefault (f )
155+ framework .ExpectNoError (err )
156+
157+ framework .ExpectLocalFileContentsImmediately ("other.txt" , "test\n " )
158+ framework .ExpectLocalFileContentsImmediately ("other2.txt" , "true\n " )
159+ framework .ExpectLocalFileContentsImmediately ("other3.txt" , "true\n " )
160+ framework .ExpectLocalFileContentsImmediately ("other-profile.txt" , "profile1\n " )
161+ framework .ExpectLocalFileContentsImmediately ("other4-0.txt" , "five\n " )
162+ framework .ExpectLocalFileContentsImmediately ("other4-1.txt" , "six\n " )
163+ })
164+
165+ ginkgo .It ("should resolve dependency pipeline flag defaults" , func () {
166+ tempDir , err := framework .CopyToTempDir ("tests/pipelines/testdata/flags" )
167+ framework .ExpectNoError (err )
168+ defer framework .CleanupTempDir (initialDir , tempDir )
169+
170+ ns , err := kubeClient .CreateNamespace ("pipelines" )
171+ framework .ExpectNoError (err )
172+ defer framework .ExpectDeleteNamespace (kubeClient , ns )
173+
174+ rootCmd := cmd .NewRootCmd (f )
175+ persistentFlags := rootCmd .PersistentFlags ()
176+ globalFlags := flags .SetGlobalFlags (persistentFlags )
177+ globalFlags .NoWarn = true
178+ globalFlags .Namespace = ns
179+ globalFlags .Profiles = []string {"profile1" }
180+
181+ cmdCtx := values .WithCommandFlags (context .Background (), globalFlags .Flags )
182+ cmdCtx = values .WithFlagsMap (cmdCtx , map [string ]string {})
183+
184+ devCmd := & cmd.RunPipelineCmd {
185+ GlobalFlags : globalFlags ,
186+ Pipeline : "arr-dep1" ,
187+ Ctx : cmdCtx ,
188+ }
189+ err = devCmd .RunDefault (f )
190+ framework .ExpectNoError (err )
191+
192+ framework .ExpectLocalFileContentsImmediately ("arr-0.txt" , "one" )
193+ framework .ExpectLocalFileContentsImmediately ("arr-1.txt" , "two" )
194+ })
195+
196+ ginkgo .It ("should resolve dependency pipeline flag defaults" , func () {
197+ tempDir , err := framework .CopyToTempDir ("tests/pipelines/testdata/flags" )
198+ framework .ExpectNoError (err )
199+ defer framework .CleanupTempDir (initialDir , tempDir )
200+
201+ ns , err := kubeClient .CreateNamespace ("pipelines" )
202+ framework .ExpectNoError (err )
203+ defer framework .ExpectDeleteNamespace (kubeClient , ns )
204+
205+ rootCmd := cmd .NewRootCmd (f )
206+ persistentFlags := rootCmd .PersistentFlags ()
207+ globalFlags := flags .SetGlobalFlags (persistentFlags )
208+ globalFlags .NoWarn = true
209+ globalFlags .Namespace = ns
210+ globalFlags .Profiles = []string {"profile1" }
211+
212+ cmdCtx := values .WithCommandFlags (context .Background (), globalFlags .Flags )
213+ cmdCtx = values .WithFlagsMap (cmdCtx , map [string ]string {})
214+
215+ devCmd := & cmd.RunPipelineCmd {
216+ GlobalFlags : globalFlags ,
217+ Pipeline : "arr-dep1-override" ,
218+ Ctx : cmdCtx ,
219+ }
220+ err = devCmd .RunDefault (f )
221+ framework .ExpectNoError (err )
222+
223+ framework .ExpectLocalFileContentsImmediately ("arr-0.txt" , "three" )
224+ framework .ExpectLocalFileContentsImmediately ("arr-1.txt" , "" )
225+ })
226+
88227 ginkgo .It ("should exec container" , func () {
89228 tempDir , err := framework .CopyToTempDir ("tests/pipelines/testdata/exec_container" )
90229 framework .ExpectNoError (err )
0 commit comments