fix fixtures
This commit is contained in:
parent
56acb77829
commit
7a2ef4f542
@ -33,12 +33,12 @@ var (
|
|||||||
func writeFiles(t *testing.T, dir string) *publisher {
|
func writeFiles(t *testing.T, dir string) *publisher {
|
||||||
pub, err := NewPublisher(dir, nodeInfo)
|
pub, err := NewPublisher(dir, nodeInfo)
|
||||||
test.NoError(t, err)
|
test.NoError(t, err)
|
||||||
test.NoError(t, pub.PublishHeader(&fixt.Header1))
|
test.NoError(t, pub.PublishHeader(&fixt.Block1_Header))
|
||||||
tx, err := pub.BeginTx()
|
tx, err := pub.BeginTx()
|
||||||
test.NoError(t, err)
|
test.NoError(t, err)
|
||||||
|
|
||||||
headerID := fixt.Header1.Hash().String()
|
headerID := fixt.Block1_Header.Hash().String()
|
||||||
test.NoError(t, pub.PublishStateNode(&fixt.StateNode1, headerID, tx))
|
test.NoError(t, pub.PublishStateNode(&fixt.Block1_StateNode0, headerID, tx))
|
||||||
|
|
||||||
test.NoError(t, tx.Commit())
|
test.NoError(t, tx.Commit())
|
||||||
return pub
|
return pub
|
||||||
@ -122,11 +122,11 @@ func TestPgCopy(t *testing.T) {
|
|||||||
BlockHash string
|
BlockHash string
|
||||||
}
|
}
|
||||||
var header res
|
var header res
|
||||||
err = conn.QueryRow(ctx, pgQueryHeader, fixt.Header1.Number.Uint64()).Scan(
|
err = conn.QueryRow(ctx, pgQueryHeader, fixt.Block1_Header.Number.Uint64()).Scan(
|
||||||
&header.CID, &header.BlockHash)
|
&header.CID, &header.BlockHash)
|
||||||
test.NoError(t, err)
|
test.NoError(t, err)
|
||||||
|
|
||||||
headerNode, err := ipld.NewEthHeader(&fixt.Header1)
|
headerNode, err := ipld.NewEthHeader(&fixt.Block1_Header)
|
||||||
test.ExpectEqual(t, headerNode.Cid().String(), header.CID)
|
test.ExpectEqual(t, headerNode.Cid().String(), header.CID)
|
||||||
test.ExpectEqual(t, fixt.Header1.Hash().String(), header.BlockHash)
|
test.ExpectEqual(t, fixt.Block1_Header.Hash().String(), header.BlockHash)
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ func writeData(t *testing.T) *publisher {
|
|||||||
driver, err := postgres.NewPGXDriver(context.Background(), pgConfig, nodeInfo)
|
driver, err := postgres.NewPGXDriver(context.Background(), pgConfig, nodeInfo)
|
||||||
test.NoError(t, err)
|
test.NoError(t, err)
|
||||||
pub := NewPublisher(postgres.NewPostgresDB(driver))
|
pub := NewPublisher(postgres.NewPostgresDB(driver))
|
||||||
test.NoError(t, pub.PublishHeader(&fixt.Header1))
|
test.NoError(t, pub.PublishHeader(&fixt.Block1_Header))
|
||||||
tx, err := pub.BeginTx()
|
tx, err := pub.BeginTx()
|
||||||
test.NoError(t, err)
|
test.NoError(t, err)
|
||||||
|
|
||||||
headerID := fixt.Header1.Hash().String()
|
headerID := fixt.Block1_Header.Hash().String()
|
||||||
test.NoError(t, pub.PublishStateNode(&fixt.StateNode1, headerID, tx))
|
test.NoError(t, pub.PublishStateNode(&fixt.Block1_StateNode0, headerID, tx))
|
||||||
|
|
||||||
test.NoError(t, tx.Commit())
|
test.NoError(t, tx.Commit())
|
||||||
return pub
|
return pub
|
||||||
@ -68,11 +68,11 @@ func TestBasic(t *testing.T) {
|
|||||||
BlockHash string
|
BlockHash string
|
||||||
}
|
}
|
||||||
var header res
|
var header res
|
||||||
err = conn.QueryRow(ctx, pgQueryHeader, fixt.Header1.Number.Uint64()).Scan(
|
err = conn.QueryRow(ctx, pgQueryHeader, fixt.Block1_Header.Number.Uint64()).Scan(
|
||||||
&header.CID, &header.BlockHash)
|
&header.CID, &header.BlockHash)
|
||||||
test.NoError(t, err)
|
test.NoError(t, err)
|
||||||
|
|
||||||
headerNode, err := ipld.NewEthHeader(&fixt.Header1)
|
headerNode, err := ipld.NewEthHeader(&fixt.Block1_Header)
|
||||||
test.ExpectEqual(t, headerNode.Cid().String(), header.CID)
|
test.ExpectEqual(t, headerNode.Cid().String(), header.CID)
|
||||||
test.ExpectEqual(t, fixt.Header1.Hash().String(), header.BlockHash)
|
test.ExpectEqual(t, fixt.Block1_Header.Hash().String(), header.BlockHash)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user