4
4
"context"
5
5
"embed"
6
6
"encoding/json"
7
- "errors"
8
7
"fmt"
9
8
"io/fs"
10
9
"os"
@@ -13,7 +12,6 @@ import (
13
12
"testing/fstest"
14
13
"text/template"
15
14
16
- "github.com/stretchr/testify/assert"
17
15
"github.com/stretchr/testify/require"
18
16
"k8s.io/apimachinery/pkg/util/yaml"
19
17
@@ -86,11 +84,11 @@ func TestRender(t *testing.T) {
86
84
image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.1.0" ): "testdata/foo-bundle-v0.1.0" ,
87
85
image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.2.0" ): "testdata/foo-bundle-v0.2.0" ,
88
86
}
89
- assert .NoError (t , generateSqliteFile (dbFile , imageMap ))
87
+ require .NoError (t , generateSqliteFile (dbFile , imageMap ))
90
88
testMigrations := migrations.Migrations {
91
89
Migrations : []migrations.Migration {
92
90
fauxMigration {"faux-migration" , "my help text" , func (d * declcfg.DeclarativeConfig ) error {
93
- for i , _ := range d .Bundles {
91
+ for i := range d .Bundles {
94
92
d .Bundles [i ].Name = fmt .Sprintf ("%s-MIGRATED" , d .Bundles [i ].Name )
95
93
}
96
94
return nil
@@ -1235,7 +1233,7 @@ func TestAllowRefMask(t *testing.T) {
1235
1233
image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.1.0" ): "testdata/foo-bundle-v0.1.0" ,
1236
1234
image .SimpleReference ("test.registry/foo-operator/foo-bundle:v0.2.0" ): "testdata/foo-bundle-v0.2.0" ,
1237
1235
}
1238
- assert .NoError (t , generateSqliteFile (dbFile , imageMap ))
1236
+ require .NoError (t , generateSqliteFile (dbFile , imageMap ))
1239
1237
1240
1238
specs := []spec {
1241
1239
{
@@ -1365,18 +1363,17 @@ func TestAllowRefMask(t *testing.T) {
1365
1363
for _ , s := range specs {
1366
1364
t .Run (s .name , func (t * testing.T ) {
1367
1365
_ , 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 )
1369
1367
})
1370
1368
}
1371
1369
}
1372
1370
1373
1371
func TestAllowRefMaskAllowed (t * testing.T ) {
1374
1372
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
1380
1377
}
1381
1378
1382
1379
specs := []spec {
0 commit comments