check indices in test
Some checks failed
Test / Run compliance tests (pull_request) Successful in 4m32s
Test / Run unit tests (pull_request) Failing after 10m1s
Test / Run integration tests (pull_request) Failing after 31m7s

This commit is contained in:
Roy Crihfield 2024-05-30 20:33:03 +08:00
parent 1b4a91703b
commit 292abcd9af

View File

@ -131,6 +131,7 @@ func DoTestPublishAndIndexTransactionIPLDs(t *testing.T, db sql.Database) {
} }
txTypeAndValueStr := `SELECT tx_type, CAST(value as TEXT) FROM eth.transaction_cids WHERE cid = $1` txTypeAndValueStr := `SELECT tx_type, CAST(value as TEXT) FROM eth.transaction_cids WHERE cid = $1`
txBlobHashQuery := `SELECT blob_hash FROM eth.blob_hashes WHERE tx_hash = $1` txBlobHashQuery := `SELECT blob_hash FROM eth.blob_hashes WHERE tx_hash = $1`
txBlobIndexQuery := `SELECT index FROM eth.blob_hashes WHERE tx_hash = $1`
switch c { switch c {
case txCIDs[0].String(): case txCIDs[0].String():
require.Equal(t, encodedTxs[0], data) require.Equal(t, encodedTxs[0], data)
@ -206,12 +207,19 @@ func DoTestPublishAndIndexTransactionIPLDs(t *testing.T, db sql.Database) {
} }
require.Equal(t, types.BlobTxType, txRes.TxType) require.Equal(t, types.BlobTxType, txRes.TxType)
require.Equal(t, transactions[5].Value().String(), txRes.Value) require.Equal(t, transactions[5].Value().String(), txRes.Value)
var txBlobHashes []common.Hash var txBlobHashes []common.Hash
var txBlobIndices []uint64
err = db.Select(context.Background(), &txBlobHashes, txBlobHashQuery, transactions[5].Hash().String()) err = db.Select(context.Background(), &txBlobHashes, txBlobHashQuery, transactions[5].Hash().String())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
require.Equal(t, transactions[5].BlobHashes(), txBlobHashes) require.Equal(t, transactions[5].BlobHashes(), txBlobHashes)
err = db.Select(context.Background(), &txBlobIndices, txBlobIndexQuery, transactions[5].Hash().String())
if err != nil {
t.Fatal(err)
}
require.Equal(t, []uint64{0, 1}, txBlobIndices)
} }
} }
} }