@@ -232,7 +232,7 @@ data:
232232 NewPresentClusterResource ("configmap" , "cm-3" , testNamespace , kubectl )
233233 })
234234
235- logger .Section ("inspect app without scope-to-fallback-allowed-namespaces" , func () {
235+ logger .Section ("inspect app with scope-to-fallback-allowed-namespaces false " , func () {
236236 const appLabelKey string = "kapp.k14s.io/app"
237237 NewClusterResource (t , "ns" , testNamespace2 , "" , kubectl )
238238 NewClusterResource (t , "cm" , "cm-4" , testNamespace2 , kubectl )
@@ -242,7 +242,7 @@ data:
242242 patch := fmt .Sprintf (`[{ "op": "add", "path": "/metadata/labels", "value": {%s: "%s"}}]` , appLabelKey , appLabel )
243243 PatchClusterResource ("cm" , "cm-4" , testNamespace2 , patch , kubectl )
244244
245- out := kapp .Run ([]string {"inspect" , "-a" , appName , "--json" })
245+ out := kapp .Run ([]string {"inspect" , "-a" , appName , "--json" , "--dangerous-scope-to-fallback-allowed-namespaces=false" })
246246
247247 // Should get the newly added configmap
248248 expectedResources := []map [string ]string {{
@@ -279,13 +279,13 @@ data:
279279 "reconcile_state" : "ok" ,
280280 }}
281281
282- resp := uitest .JSONUIFromBytes (t , []byte (out ))
282+ resp := uitest .JSONUIFromBytes (t , []byte (removeCobraFlagDeprecationWarning ( out , "dangerous-scope-to-fallback-allowed-namespaces" ) ))
283283
284284 require .Equalf (t , expectedResources , replaceAge ((resp .Tables [0 ].Rows )), "Expected resources to match" )
285285 })
286286
287- logger .Section ("inspect app with scope-to-fallback-allowed-namespaces" , func () {
288- out := kapp .Run ([]string {"inspect" , "-a" , appName , "--json" , "--dangerous-scope-to-fallback-allowed-namespaces" })
287+ logger .Section ("inspect app without scope-to-fallback-allowed-namespaces" , func () {
288+ out := kapp .Run ([]string {"inspect" , "-a" , appName , "--json" })
289289
290290 // Shouldn't get the newly added configmap
291291 expectedResources := []map [string ]string {{
@@ -319,8 +319,8 @@ data:
319319 require .Equalf (t , expectedResources , replaceAge ((resp .Tables [0 ].Rows )), "Expected resources to match" )
320320 })
321321
322- logger .Section ("delete one configmap and deploy again with scope-to-fallback-allowed-namespaces " , func () {
323- kapp .RunWithOpts ([]string {"deploy" , "-a" , appName , "-f" , "-" , "--dangerous-scope-to-fallback-allowed-namespaces" },
322+ logger .Section ("delete one configmap and deploy again without " , func () {
323+ kapp .RunWithOpts ([]string {"deploy" , "-a" , appName , "-f" , "-" },
324324 RunOpts {StdinReader : strings .NewReader (yaml2 )})
325325
326326 NewPresentClusterResource ("configmap" , "cm-1" , env .Namespace , kubectl )
@@ -329,7 +329,7 @@ data:
329329 })
330330
331331 logger .Section ("delete app" , func () {
332- kapp .Run ([]string {"delete" , "-a" , appName , "--dangerous-scope-to-fallback-allowed-namespaces" })
332+ kapp .Run ([]string {"delete" , "-a" , appName })
333333
334334 NewMissingClusterResource (t , "configmap" , "cm-1" , env .Namespace , kubectl )
335335 NewMissingClusterResource (t , "configmap" , "cm-2" , testNamespace , kubectl )
@@ -356,3 +356,15 @@ func ScopedContext(t *testing.T, kubectl Kubectl, _, contextName, userName strin
356356 kubectl .Run ([]string {"config" , "delete-user" , userName })
357357 }
358358}
359+
360+ func removeCobraFlagDeprecationWarning (output , flag string ) string {
361+ newOut := ""
362+ lines := strings .Split (output , "\n " )
363+ for _ , line := range lines {
364+ if strings .Contains (line , fmt .Sprintf ("Flag --%s has been deprecated" , flag )) {
365+ continue
366+ }
367+ newOut += line + "\n "
368+ }
369+ return newOut
370+ }
0 commit comments