1- // Copyright 2019- 2026 The kpt Authors.
1+ // Copyright 2019, 2026 The Kubernetes Authors.
22// SPDX-License-Identifier: Apache-2.0
33
44package cmdcat
@@ -14,6 +14,7 @@ import (
1414
1515 "github.com/kptdev/kpt/pkg/printer"
1616 "github.com/stretchr/testify/assert"
17+ "github.com/stretchr/testify/require"
1718)
1819
1920const f1Yaml = "f1.yaml"
8889` )
8990
9091 got , err := runCat (t , d )
91- assert .NoError (t , err )
92+ require .NoError (t , err )
9293 assert .Equal (t , `kind: Deployment
9394metadata:
9495 labels:
@@ -149,7 +150,7 @@ spec:
149150` )
150151
151152 got , err := runCat (t , filepath .Join (d , f1Yaml ))
152- assert .NoError (t , err )
153+ require .NoError (t , err )
153154 assert .Equal (t , `kind: Deployment
154155metadata:
155156 labels:
@@ -179,7 +180,7 @@ spec:
179180` )
180181
181182 got , err := runCat (t , filepath .Join (d , f1Yaml ), "--annotate" )
182- assert .NoError (t , err )
183+ require .NoError (t , err )
183184 assert .Equal (t , `kind: Deployment
184185metadata:
185186 labels:
@@ -208,7 +209,7 @@ metadata:
208209` )
209210
210211 got , err := runCat (t , filepath .Join (d , f1Yaml ))
211- assert .NoError (t , err )
212+ require .NoError (t , err )
212213 assert .NotContains (t , got , "config.kubernetes.io/path" ,
213214 "config.kubernetes.io/path should be cleared by default" )
214215 assert .NotContains (t , got , "internal.config.kubernetes.io/path" ,
@@ -246,7 +247,7 @@ spec:
246247` )
247248
248249 got , err := runCat (t , d )
249- assert .NoError (t , err )
250+ require .NoError (t , err )
250251 assert .Equal (t , `kind: Deployment
251252metadata:
252253 labels:
@@ -299,7 +300,7 @@ metadata:
299300` )
300301
301302 got , err := runCat (t , d )
302- assert .NoError (t , err )
303+ require .NoError (t , err )
303304 // exactly one of each resource, separated by a single ---.
304305 assert .Equal (t , 2 , strings .Count (got , "\n kind: ConfigMap\n " ),
305306 "each pkg should be emitted exactly once" )
@@ -340,7 +341,7 @@ metadata:
340341 }()
341342
342343 got , err := runCat (t , arg )
343- assert .NoError (t , err )
344+ require .NoError (t , err )
344345 assert .Equal (t , 1 , strings .Count (got , "\n kind: ConfigMap\n " ),
345346 "arg %q should yield exactly one resource" , arg )
346347 })
@@ -371,7 +372,7 @@ metadata:
371372` )
372373
373374 got , err := runCat (t , d )
374- assert .NoError (t , err )
375+ require .NoError (t , err )
375376 assert .False (t , strings .HasSuffix (got , "---\n " ) || strings .HasSuffix (got , "---" ),
376377 "output must not end with a stray separator; got %q" , got )
377378 assert .Equal (t , 0 , strings .Count (got , "\n ---\n " ),
@@ -477,7 +478,7 @@ metadata:
477478` )
478479
479480 got , err := runCat (t , d , "-R=false" )
480- assert .NoError (t , err )
481+ require .NoError (t , err )
481482 assert .Contains (t , got , "name: root-cm" )
482483 assert .NotContains (t , got , "name: sub-cm" ,
483484 "sub-pkg should not be traversed when -R=false" )
@@ -494,7 +495,7 @@ metadata:
494495` )
495496
496497 got , err := runCat (t , filepath .Join (d , "f.yaml" ), "--strip-comments" )
497- assert .NoError (t , err )
498+ require .NoError (t , err )
498499 assert .NotContains (t , got , "top comment" )
499500 assert .NotContains (t , got , "inline comment" )
500501}
@@ -513,7 +514,7 @@ data:
513514` )
514515
515516 got , err := runCat (t , filepath .Join (d , "f.yaml" ), "--format=false" )
516- assert .NoError (t , err )
517+ require .NoError (t , err )
517518 zIdx := strings .Index (got , "z-last" )
518519 aIdx := strings .Index (got , "a-first" )
519520 assert .True (t , zIdx >= 0 && aIdx >= 0 , "both keys should be present" )
0 commit comments