Skip to content

Commit 361ad19

Browse files
committed
fix integration tests
1 parent 721a9b5 commit 361ad19

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

integrationtests/miniblocks_test.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ package integrationtests
44

55
import (
66
"context"
7+
"encoding/hex"
78
"testing"
89

910
dataBlock "github.com/multiversx/mx-chain-core-go/data/block"
11+
"github.com/multiversx/mx-chain-core-go/data/outport"
1012
"github.com/multiversx/mx-chain-core-go/marshal"
1113
indexerdata "github.com/multiversx/mx-chain-es-indexer-go/process/dataindexer"
1214
"github.com/stretchr/testify/require"
@@ -31,7 +33,12 @@ func TestIndexMiniBlocksOnSourceAndDestination(t *testing.T) {
3133
ReceiverShardID: 2,
3234
},
3335
}
34-
err = esProc.SaveMiniblocks(header, miniBlocks, 1234000)
36+
37+
body := &dataBlock.Body{MiniBlocks: miniBlocks}
38+
pool := &outport.TransactionPool{}
39+
ob := createOutportBlockWithHeader(body, header, pool, nil, testNumOfShards)
40+
ob.BlockData.HeaderHash, _ = hex.DecodeString("3fede8a9a3c4f2ba6d7e6e01541813606cd61c4d3af2940f8e089827b5d94e50")
41+
err = esProc.SaveMiniblocks(ob)
3542
require.Nil(t, err)
3643
mbHash := "11a1bb4065e16a2e93b2b5ac5957b7b69f1cfba7579b170b24f30dab2d3162e0"
3744
ids := []string{mbHash}
@@ -57,7 +64,9 @@ func TestIndexMiniBlocksOnSourceAndDestination(t *testing.T) {
5764
},
5865
}
5966

60-
err = esProc.SaveMiniblocks(header, miniBlocks, 1234000)
67+
ob = createOutportBlockWithHeader(body, header, pool, nil, testNumOfShards)
68+
ob.BlockData.HeaderHash, _ = hex.DecodeString("d7f1e8003a45c7adbd87bbbb269cb4af3d1f4aedd0c214973bfc096dd0f3b65e")
69+
err = esProc.SaveMiniblocks(ob)
6170
require.Nil(t, err)
6271

6372
err = esClient.DoMultiGet(context.Background(), ids, indexerdata.MiniblocksIndex, true, genericResponse)
@@ -96,7 +105,12 @@ func TestIndexMiniBlockFirstOnDestinationAndAfterSource(t *testing.T) {
96105
},
97106
}
98107

99-
err = esProc.SaveMiniblocks(header, miniBlocks, 54321000)
108+
pool := &outport.TransactionPool{}
109+
body := &dataBlock.Body{MiniBlocks: miniBlocks}
110+
ob := createOutportBlockWithHeader(body, header, pool, nil, testNumOfShards)
111+
ob.BlockData.HeaderHash, _ = hex.DecodeString("b36435faaa72390772da84f418348ce0d477c74432579519bf0ffea1dc4c36e9")
112+
ob.BlockData.TimestampMs = 54321000
113+
err = esProc.SaveMiniblocks(ob)
100114
require.Nil(t, err)
101115
genericResponse := &GenericResponse{}
102116

@@ -116,7 +130,10 @@ func TestIndexMiniBlockFirstOnDestinationAndAfterSource(t *testing.T) {
116130
Reserved: mbhrBytes,
117131
},
118132
}
119-
err = esProc.SaveMiniblocks(header, miniBlocks, 54321000)
133+
134+
ob = createOutportBlockWithHeader(body, header, pool, nil, testNumOfShards)
135+
ob.BlockData.HeaderHash, _ = hex.DecodeString("b601381e1f41df2aa3da9f2b8eb169f14c86418229e30fc65f9e6b37b7f0d902")
136+
err = esProc.SaveMiniblocks(ob)
120137
require.Nil(t, err)
121138
err = esClient.DoMultiGet(context.Background(), ids, indexerdata.MiniblocksIndex, true, genericResponse)
122139
require.Nil(t, err)

process/elasticproc/elasticProcessor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func (ei *elasticProcessor) SaveMiniblocks(obh *outport.OutportBlockWithHeader)
438438
NumberOfShards: obh.NumberOfShards,
439439
HeaderHash: obh.BlockData.HeaderHash,
440440
}
441-
miniBlocks := append(obh.BlockData.Body.MiniBlocks, obh.BlockData.Body.MiniBlocks...)
441+
miniBlocks := append(obh.BlockData.Body.MiniBlocks, obh.BlockData.IntraShardMiniBlocks...)
442442
mbs := ei.miniblocksProc.PrepareDBMiniblocks(headerData, miniBlocks)
443443
ei.miniblocksProc.SerializeBulkMiniBlocks(mbs, buffSlice, elasticIndexer.MiniblocksIndex, headerData.ShardID)
444444

0 commit comments

Comments
 (0)