File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
package watcher
2
2
3
3
import (
4
+ "context"
4
5
"testing"
5
6
"time"
6
7
7
8
"github.com/stretchr/testify/assert"
9
+ "github.com/stretchr/testify/require"
8
10
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
9
11
"sigs.k8s.io/controller-runtime/pkg/client"
10
12
@@ -284,6 +286,7 @@ func TestGetLatestBackup(t *testing.T) {
284
286
},
285
287
}
286
288
289
+ ctx := context .Background ()
287
290
for _ , tt := range tests {
288
291
t .Run (tt .name , func (t * testing.T ) {
289
292
client := testutils .BuildFakeClient (tt .backups ... )
@@ -295,12 +298,12 @@ func TestGetLatestBackup(t *testing.T) {
295
298
},
296
299
}
297
300
298
- latest , err := getLatestBackup (t . Context () , client , cluster )
301
+ latest , err := getLatestBackup (ctx , client , cluster )
299
302
if tt .expectedErr != nil {
300
- assert .EqualError (t , err , tt .expectedErr .Error ())
303
+ require .EqualError (t , err , tt .expectedErr .Error ())
301
304
assert .Nil (t , latest )
302
305
} else {
303
- assert .NoError (t , err )
306
+ require .NoError (t , err )
304
307
assert .NotNil (t , latest )
305
308
assert .Equal (t , latest .Name , tt .latestBackupName )
306
309
}
You can’t perform that action at this time.
0 commit comments