Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Aug 12, 2024
1 parent 32dea94 commit 8f1d9dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 3 additions & 0 deletions common/fixture/atxs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ func (g *AtxsGenerator) Next() *types.ActivationTx {
PublishEpoch: g.Epochs[g.rng.Intn(len(g.Epochs))],
Coinbase: wallet.Address(nodeID.Bytes()),
NumUnits: g.rng.Uint32(),
TickCount: 1,
SmesherID: nodeID,
}
atx.SetID(types.RandomATXID())
atx.SetReceived(time.Now().Local())
return atx
}
10 changes: 3 additions & 7 deletions datastore/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"

"github.com/spacemeshos/go-spacemesh/activation/wire"
"github.com/spacemeshos/go-spacemesh/codec"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/datastore"
Expand Down Expand Up @@ -100,18 +99,15 @@ func TestBlobStore_GetATXBlob(t *testing.T) {
_, err = getBytes(ctx, bs, datastore.ATXDB, atx.ID())
require.ErrorIs(t, err, datastore.ErrNotFound)

require.NoError(t, atxs.Add(db, atx, types.AtxBlob{Blob: types.RandomBytes(100)}))
blob := types.AtxBlob{Blob: types.RandomBytes(100)}
require.NoError(t, atxs.Add(db, atx, blob))

has, err = bs.Has(datastore.ATXDB, atx.ID().Bytes())
require.NoError(t, err)
require.True(t, has)
got, err := getBytes(ctx, bs, datastore.ATXDB, atx.ID())
require.NoError(t, err)

gotA, err := wire.DecodeAtxV1(got)
require.NoError(t, err)
require.Equal(t, atx.ID(), gotA.ID())
require.Equal(t, atx, gotA)
require.Equal(t, blob.Blob, got)

_, err = getBytes(ctx, bs, datastore.BallotDB, atx.ID())
require.ErrorIs(t, err, datastore.ErrNotFound)
Expand Down

0 comments on commit 8f1d9dc

Please sign in to comment.