Skip to content

Commit

Permalink
Fix deepsource checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dimartiro committed Aug 10, 2023
1 parent 3293693 commit 634f315
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
12 changes: 5 additions & 7 deletions dot/state/storage_notify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,18 @@ func Test_Example(t *testing.T) {
}

if err := db.Subscribe(ctx, cb, match); err != nil && err != context.Canceled {
log.Fatal(err)
t.Error(err)
}
log.Printf("subscription closed")
}()

// 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")
Expand Down
4 changes: 2 additions & 2 deletions dot/state/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion dot/state/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -235,6 +235,7 @@ func AddBlocksToStateWithFixedBranches(t *testing.T, blockState *BlockState, dep
}
}

//lint:ignore U1000 this has a real reason
func generateBlockWithRandomTrie(t *testing.T, serv *Service,
parent *common.Hash, bNum uint) (*types.Block, *runtime.TrieState) {
trieState, err := serv.Storage.TrieState(nil)
Expand Down

0 comments on commit 634f315

Please sign in to comment.