@@ -53,19 +53,18 @@ func TestClusterHeights(t *testing.T) {
5353
5454 // First index a block ID for the cluster and height
5555 firstBlockID := unittest .IdentifierFixture ()
56- unittest .WithLock (t , lockManager , storage .LockInsertOrFinalizeClusterBlock , func (lctx lockctx.Context ) error {
56+ err := unittest .WithLock (t , lockManager , storage .LockInsertOrFinalizeClusterBlock , func (lctx lockctx.Context ) error {
5757 return db .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
5858 return operation .IndexClusterBlockHeight (lctx , rw , testClusterID , testHeight , firstBlockID )
5959 })
6060 })
61+ require .NoError (t , err )
6162
6263 // Try to index a different block ID for the same cluster and height
6364 differentBlockID := unittest .IdentifierFixture ()
64- var err error
65- unittest .WithLock (t , lockManager , storage .LockInsertOrFinalizeClusterBlock , func (lctx lockctx.Context ) error {
65+ err = unittest .WithLock (t , lockManager , storage .LockInsertOrFinalizeClusterBlock , func (lctx lockctx.Context ) error {
6666 return db .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
67- err = operation .IndexClusterBlockHeight (lctx , rw , testClusterID , testHeight , differentBlockID )
68- return nil // Don't return the error here, we want to check it outside
67+ return operation .IndexClusterBlockHeight (lctx , rw , testClusterID , testHeight , differentBlockID )
6968 })
7069 })
7170
@@ -132,8 +131,9 @@ func Test_RetrieveClusterFinalizedHeight(t *testing.T) {
132131 return operation .UpdateClusterFinalizedHeight (lctx , rw , clusterID , 21 )
133132 })
134133 })
134+ require .NoError (t , err )
135135
136- unittest .WithLock (t , lockManager , storage .LockInsertOrFinalizeClusterBlock , func (lctx lockctx.Context ) error {
136+ err = unittest .WithLock (t , lockManager , storage .LockInsertOrFinalizeClusterBlock , func (lctx lockctx.Context ) error {
137137 return db .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
138138 return operation .UpdateClusterFinalizedHeight (lctx , rw , clusterID , 22 )
139139 })
0 commit comments