Skip to content

Commit

Permalink
refactor: move testdata from pkg to testutil (#2296)
Browse files Browse the repository at this point in the history
* chore: move testdata from pkg to testutil

* fix imports

* Add changelog entry

* Fix pathname in headers_test

---------

Co-authored-by: Lucas Bertrand <[email protected]>
  • Loading branch information
jasonmokk and lumtis authored Jun 4, 2024
1 parent f4366ad commit 6c8e5a6
Show file tree
Hide file tree
Showing 178 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20
* [2290](https://github.com/zeta-chain/node/pull/2290) - rename `MsgAddBlameVote` message to `MsgVoteBlame`
* [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags
* [2296](https://github.com/zeta-chain/node/pull/2296) - move `testdata` package to `testutil` to organize test-related utilities

### Tests

Expand Down
2 changes: 1 addition & 1 deletion pkg/proofs/bitcoin/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/btcsuite/btcutil"
"github.com/stretchr/testify/require"

"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
)

func TestBitcoinMerkleProof(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/proofs/ethereum/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/require"

"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
)

func TestProofGeneration(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/proofs/headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import (
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/require"

"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
)

const numHeadersToTest = 100

func TestTrueEthereumHeader(t *testing.T) {
var header ethtypes.Header
// read file into a byte slice
file, err := os.Open("../testdata/eth_header_18495266.json")
file, err := os.Open("../../testutil/testdata/eth_header_18495266.json")
require.NoError(t, err)
defer file.Close()
headerBytes := make([]byte, 4096)
Expand All @@ -52,7 +52,7 @@ func TestTrueEthereumHeader(t *testing.T) {
func TestFalseEthereumHeader(t *testing.T) {
var header ethtypes.Header
// read file into a byte slice
file, err := os.Open("../testdata/eth_header_18495266.json")
file, err := os.Open("../../testutil/testdata/eth_header_18495266.json")
require.NoError(t, err)
defer file.Close()
headerBytes := make([]byte, 4096)
Expand Down
2 changes: 1 addition & 1 deletion pkg/proofs/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/zeta-chain/zetacore/pkg/proofs/bitcoin"
"github.com/zeta-chain/zetacore/pkg/proofs/ethereum"
"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion testutil/sample/lightclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/zeta-chain/zetacore/pkg/chains"
"github.com/zeta-chain/zetacore/pkg/proofs"
"github.com/zeta-chain/zetacore/pkg/proofs/ethereum"
"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion x/authority/client/cli/tx_update_chain_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/zeta-chain/zetacore/pkg/chains"
"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
"github.com/zeta-chain/zetacore/x/authority/client/cli"
)

Expand Down
2 changes: 1 addition & 1 deletion x/authority/client/cli/tx_update_policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/zeta-chain/zetacore/pkg/testdata"
"github.com/zeta-chain/zetacore/testutil/testdata"
"github.com/zeta-chain/zetacore/x/authority/client/cli"
authoritytypes "github.com/zeta-chain/zetacore/x/authority/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/observer/types/message_vote_block_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func TestMsgVoteBlockHeader_ValidateBasic(t *testing.T) {
keeper.SetConfig(false)
var header ethtypes.Header
file, err := os.Open("../../../pkg/testdata/eth_header_18495266.json")
file, err := os.Open("../../../testutil/testdata/eth_header_18495266.json")
require.NoError(t, err)
defer file.Close()
headerBytes := make([]byte, 4096)
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/zetacore/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func MockBroadcastError(_ *Client, _ uint64, _ sdktypes.Msg, _ authz.Signer) (st

func getHeaderData(t *testing.T) proofs.HeaderData {
var header ethtypes.Header
file, err := os.Open("../../pkg/testdata/eth_header_18495266.json")
file, err := os.Open("../../testutil/testdata/eth_header_18495266.json")
require.NoError(t, err)
defer file.Close()
headerBytes := make([]byte, 4096)
Expand Down

0 comments on commit 6c8e5a6

Please sign in to comment.