From 8f1d9dcd09d6e2c0c5c129dc3038fe1147547df1 Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:28:30 +0000 Subject: [PATCH] Fix failing tests --- common/fixture/atxs.go | 3 +++ datastore/store_test.go | 10 +++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/common/fixture/atxs.go b/common/fixture/atxs.go index 462df8269f..dc61c18b8b 100644 --- a/common/fixture/atxs.go +++ b/common/fixture/atxs.go @@ -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 } diff --git a/datastore/store_test.go b/datastore/store_test.go index c2849e17b6..b3ae9fe55b 100644 --- a/datastore/store_test.go +++ b/datastore/store_test.go @@ -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" @@ -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)