From b8161959bbf58ef7b1d5d41e34096391f2533a7a Mon Sep 17 00:00:00 2001 From: Diego Date: Thu, 10 Aug 2023 18:14:39 -0300 Subject: [PATCH] Fix deepsource checks --- dot/state/storage_notify_test.go | 10 ++++------ dot/state/storage_test.go | 4 ++-- dot/state/test_helpers.go | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dot/state/storage_notify_test.go b/dot/state/storage_notify_test.go index 1f2f0da5519..31e8e4bd30f 100644 --- a/dot/state/storage_notify_test.go +++ b/dot/state/storage_notify_test.go @@ -182,13 +182,11 @@ func Test_Example(t *testing.T) { // Write both keys, but only one should be printed in the Output. err := db.Put(aKey, aValue) - if err != nil { - log.Fatal(err) - } + require.NoError(t, err) + err = db.Put(bKey, bValue) - if err != nil { - log.Fatal(err) - } + require.NoError(t, err) + log.Printf("stopping subscription") cancel() log.Printf("waiting for subscription to close") diff --git a/dot/state/storage_test.go b/dot/state/storage_test.go index fd0e597f0a9..7d6da57e65a 100644 --- a/dot/state/storage_test.go +++ b/dot/state/storage_test.go @@ -45,8 +45,8 @@ func TestStorage_StoreAndLoadTrie(t *testing.T) { trie, err := storage.LoadFromDB(root) require.NoError(t, err) ts2 := runtime.NewTrieState(trie) - new := ts2.Snapshot() - require.Equal(t, ts.Trie(), new) + newTrie := ts2.Snapshot() + require.Equal(t, ts.Trie(), newTrie) } func TestStorage_GetStorageByBlockHash(t *testing.T) { diff --git a/dot/state/test_helpers.go b/dot/state/test_helpers.go index 56255b3198a..a3b16ec9c65 100644 --- a/dot/state/test_helpers.go +++ b/dot/state/test_helpers.go @@ -153,7 +153,7 @@ func AddBlocksToState(t *testing.T, blockState *BlockState, depth uint, // branches are provided with a map of depth -> # of branches func AddBlocksToStateWithFixedBranches(t *testing.T, blockState *BlockState, depth uint, branches map[uint]int) { bestBlockHash := blockState.BestBlockHash() - tb := []testBranch{} + var tb []testBranch arrivalTime := time.Now() rt, err := blockState.GetRuntime(bestBlockHash)