44 "context"
55 "embed"
66 "encoding/json"
7- "errors"
87 "fmt"
98 "io/fs"
109 "os"
@@ -13,7 +12,6 @@ import (
1312 "testing/fstest"
1413 "text/template"
1514
16- "github.com/stretchr/testify/assert"
1715 "github.com/stretchr/testify/require"
1816 "k8s.io/apimachinery/pkg/util/yaml"
1917
@@ -86,11 +84,11 @@ func TestRender(t *testing.T) {
8684 image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.1.0" ): "testdata/foo-bundle-v0.1.0" ,
8785 image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.2.0" ): "testdata/foo-bundle-v0.2.0" ,
8886 }
89- assert .NoError (t , generateSqliteFile (dbFile , imageMap ))
87+ require .NoError (t , generateSqliteFile (dbFile , imageMap ))
9088 testMigrations := migrations.Migrations {
9189 Migrations : []migrations.Migration {
9290 fauxMigration {"faux-migration" , "my help text" , func (d * declcfg.DeclarativeConfig ) error {
93- for i , _ := range d .Bundles {
91+ for i := range d .Bundles {
9492 d .Bundles [i ].Name = fmt .Sprintf ("%s-MIGRATED" , d .Bundles [i ].Name )
9593 }
9694 return nil
@@ -1235,7 +1233,7 @@ func TestAllowRefMask(t *testing.T) {
12351233 image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.1.0" ): "testdata/foo-bundle-v0.1.0" ,
12361234 image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.2.0" ): "testdata/foo-bundle-v0.2.0" ,
12371235 }
1238- assert .NoError (t , generateSqliteFile (dbFile , imageMap ))
1236+ require .NoError (t , generateSqliteFile (dbFile , imageMap ))
12391237
12401238 specs := []spec {
12411239 {
@@ -1365,18 +1363,17 @@ func TestAllowRefMask(t *testing.T) {
13651363 for _ , s := range specs {
13661364 t .Run (s .name , func (t * testing.T ) {
13671365 _ , err := s .render .Run (context .Background ())
1368- require .True (t , errors . Is ( err , s .expectErr ) , "expected error %#v to be %#v" , err , s .expectErr )
1366+ require .ErrorIs (t , err , s .expectErr , "expected error %#v to be %#v" , err , s .expectErr )
13691367 })
13701368 }
13711369}
13721370
13731371func TestAllowRefMaskAllowed (t * testing.T ) {
13741372 type spec struct {
1375- name string
1376- mask action.RefType
1377- pass []action.RefType
1378- fail []action.RefType
1379- expect bool
1373+ name string
1374+ mask action.RefType
1375+ pass []action.RefType
1376+ fail []action.RefType
13801377 }
13811378
13821379 specs := []spec {
0 commit comments