Skip to content

Commit

Permalink
Add TestGetLastBlockProcessedDurableStore
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseguy committed Aug 23, 2023
1 parent d3d0abd commit 0a35258
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion node/engine/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func TestGetChannelsByParticipant(t *testing.T) {
}
}

func TestGetLastBlockProcessed(t *testing.T) {
func TestGetLastBlockProcessedMemStore(t *testing.T) {
sk := common.Hex2Bytes(`2af069c584758f9ec47c4224a8becc1983f28acfbe837bd7710b70f9fc6d5e44`)
ms := store.NewMemStore(sk)

Expand All @@ -237,6 +237,27 @@ func TestGetLastBlockProcessed(t *testing.T) {
}
}

func TestGetLastBlockProcessedDurableStore(t *testing.T) {
pk := common.Hex2Bytes(`2af069c584758f9ec47c4224a8becc1983f28acfbe837bd7710b70f9fc6d5e44`)
dataFolder := fmt.Sprintf("%s/%d%d", STORE_TEST_DATA_FOLDER, rand.Uint64(), time.Now().UnixNano())
durableStore, err := store.NewDurableStore(pk, dataFolder, buntdb.Config{})
if err != nil {
t.Fatal(err)
}

want := uint64(15)
_ = durableStore.SetLastBlockProcessed(want)

got, err := durableStore.GetLastBlockProcessed()
if err != nil {
t.Fatal(err)
}

if diff := cmp.Diff(got, want); diff != "" {
t.Fatalf("fetched result different than expected %s", diff)
}
}

func TestBigNumberStorage(t *testing.T) {
pk := common.Hex2Bytes(`2af069c584758f9ec47c4224a8becc1983f28acfbe837bd7710b70f9fc6d5e44`)

Expand Down

0 comments on commit 0a35258

Please sign in to comment.