Skip to content

Commit 7c66669

Browse files
committed
update tests
1 parent e66064b commit 7c66669

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

storage/store/protocol_kv_store_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ func TestProtocolKVStore_StoreTx(t *testing.T) {
7474
})
7575
require.NoError(t, err)
7676

77-
// Store same data again - should not error
77+
// Store same data again - should error
7878
err = unittest.WithLock(t, lockManager, storage.LockInsertBlock, func(lctx lockctx.Context) error {
7979
return db.WithReaderBatchWriter(func(rw storage.ReaderBatchWriter) error {
8080
return store.BatchStore(lctx, rw, stateID, expected)
8181
})
8282
})
83-
require.NoError(t, err)
83+
require.ErrorIs(t, err, storage.ErrAlreadyExists)
8484

8585
// Attempt to store different data with the same stateID
8686
dataDifferent := &flow.PSKeyValueStoreData{
@@ -93,7 +93,7 @@ func TestProtocolKVStore_StoreTx(t *testing.T) {
9393
return store.BatchStore(lctx, rw, stateID, dataDifferent)
9494
})
9595
})
96-
require.ErrorIs(t, err, storage.ErrDataMismatch)
96+
require.ErrorIs(t, err, storage.ErrAlreadyExists)
9797

9898
// Attempt to store different version with the same stateID
9999
versionDifferent := &flow.PSKeyValueStoreData{
@@ -106,7 +106,7 @@ func TestProtocolKVStore_StoreTx(t *testing.T) {
106106
return store.BatchStore(lctx, rw, stateID, versionDifferent)
107107
})
108108
})
109-
require.ErrorIs(t, err, storage.ErrDataMismatch)
109+
require.ErrorIs(t, err, storage.ErrAlreadyExists)
110110
})
111111
}
112112

@@ -131,13 +131,13 @@ func TestProtocolKVStore_IndexTx(t *testing.T) {
131131
})
132132
require.NoError(t, err)
133133

134-
// Index same data again - should not error
134+
// Index same data again - should error with storage.ErrAlreadyExists
135135
err = unittest.WithLock(t, lockManager, storage.LockInsertBlock, func(lctx lockctx.Context) error {
136136
return db.WithReaderBatchWriter(func(rw storage.ReaderBatchWriter) error {
137137
return store.BatchIndex(lctx, rw, blockID, stateID)
138138
})
139139
})
140-
require.NoError(t, err)
140+
require.ErrorIs(t, err, storage.ErrAlreadyExists)
141141

142142
// Attempt to index different stateID with same blockID
143143
differentStateID := unittest.IdentifierFixture()
@@ -146,7 +146,7 @@ func TestProtocolKVStore_IndexTx(t *testing.T) {
146146
return store.BatchIndex(lctx, rw, blockID, differentStateID)
147147
})
148148
})
149-
require.ErrorIs(t, err, storage.ErrDataMismatch)
149+
require.ErrorIs(t, err, storage.ErrAlreadyExists)
150150
})
151151
}
152152

0 commit comments

Comments
 (0)