Skip to content

Commit bfaa3d8

Browse files
authored
test: Refactor initSA to simplify cleanup in tests (#8525)
Using [`T.Cleanup`](https://pkg.go.dev/testing#T.Cleanup) allows to slightly simplify tests.
1 parent 6e253fb commit bfaa3d8

File tree

2 files changed

+78
-146
lines changed

2 files changed

+78
-146
lines changed

sa/model_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ func TestPopulateAttemptedFieldsBadJSON(t *testing.T) {
299299
func TestCertificatesTableContainsDuplicateSerials(t *testing.T) {
300300
ctx := context.Background()
301301

302-
sa, fc, cleanUp := initSA(t)
303-
defer cleanUp()
302+
sa, fc := initSA(t)
304303

305304
serialString := core.SerialToString(big.NewInt(1337))
306305

@@ -414,8 +413,7 @@ func TestIncidentSerialModel(t *testing.T) {
414413
}
415414

416415
func TestAddReplacementOrder(t *testing.T) {
417-
sa, _, cleanUp := initSA(t)
418-
defer cleanUp()
416+
sa, _ := initSA(t)
419417

420418
oldCertSerial := "1234567890"
421419
orderId := int64(1337)
@@ -459,8 +457,7 @@ func TestAddReplacementOrder(t *testing.T) {
459457
}
460458

461459
func TestSetReplacementOrderFinalized(t *testing.T) {
462-
sa, _, cleanUp := initSA(t)
463-
defer cleanUp()
460+
sa, _ := initSA(t)
464461

465462
oldCertSerial := "1234567890"
466463
orderId := int64(1337)

0 commit comments

Comments
 (0)