diff --git a/integration/storagetest/logtests.go b/integration/storagetest/logtests.go index 8dcaef20fb..aafd8bad22 100644 --- a/integration/storagetest/logtests.go +++ b/integration/storagetest/logtests.go @@ -146,23 +146,22 @@ func (*logTests) TestSnapshot(ctx context.Context, t *testing.T, s storage.LogSt func (*logTests) TestReadWriteTransaction(ctx context.Context, t *testing.T, s storage.LogStorage, as storage.AdminStorage) { activeLog := mustCreateTree(ctx, t, as, storageto.LogTree) - mustSignAndStoreLogRoot(ctx, t, s, activeLog, &types.LogRootV1{RootHash: []byte{0}}) tests := []struct { desc string - tree *trillian.Tree + doBefore func() wantNeedsInit bool wantErr bool wantLogRoot []byte }{ { desc: "uninitializedBegin", - tree: logTree(-1), + doBefore: func() {}, wantNeedsInit: true, }, { - desc: "activeLogBegin", - tree: activeLog, + desc: "activeLogBegin", + doBefore: func() { mustSignAndStoreLogRoot(ctx, t, s, activeLog, &types.LogRootV1{RootHash: []byte{0}}) }, wantLogRoot: func() []byte { b, err := (&types.LogRootV1{RootHash: []byte{0}}).MarshalBinary() if err != nil { @@ -175,7 +174,8 @@ func (*logTests) TestReadWriteTransaction(ctx context.Context, t *testing.T, s s for _, test := range tests { t.Run(test.desc, func(t *testing.T) { - err := s.ReadWriteTransaction(ctx, test.tree, func(ctx context.Context, tx storage.LogTreeTX) error { + test.doBefore() + err := s.ReadWriteTransaction(ctx, activeLog, func(ctx context.Context, tx storage.LogTreeTX) error { root, err := tx.LatestSignedLogRoot(ctx) if err != nil && !(err == storage.ErrTreeNeedsInit && test.wantNeedsInit) { t.Fatalf("%v: LatestSignedLogRoot() returned err = %v", test.desc, err)