diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 377035025..c7ae92b3b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @strangelove-ventures/ibctest-maintainers +* @strangelove-ventures/interchaintest-maintainers diff --git a/.github/workflows/strangelove-project-management.yaml b/.github/workflows/strangelove-project-management.yaml index b09597610..e0023dd71 100644 --- a/.github/workflows/strangelove-project-management.yaml +++ b/.github/workflows/strangelove-project-management.yaml @@ -15,7 +15,7 @@ jobs: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'reopened') steps: - name: Add Issue to "Motherboard" Project Board - uses: leonsteinhaeuser/project-beta-automations@v1.2.1 + uses: leonsteinhaeuser/project-beta-automations@v2.0.1 with: gh_app_secret_key: ${{ secrets.MB_SECRET_KEY }} gh_app_ID: ${{ secrets.MB_APP_ID }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 40994ec84..6a0658092 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,13 +21,13 @@ jobs: with: go-version: 1.19 - - name: checkout ibctest + - name: checkout interchaintest uses: actions/checkout@v3 # cleanup environment on self-hosted test runner - name: clean run: |- - rm -rf ~/.ibctest + rm -rf ~/.interchaintest # run tests - name: run unit tests @@ -43,17 +43,17 @@ jobs: with: go-version: 1.19 - - name: checkout ibctest + - name: checkout interchaintest uses: actions/checkout@v3 # cleanup environment on self-hosted test runner - name: clean run: |- - rm -rf ~/.ibctest + rm -rf ~/.interchaintest # run tests - name: run conformance tests - run: (go test -race -timeout 30m -v -p 2 ./cmd/ibctest) || (echo "\n\n*****CHAIN and RELAYER LOGS*****" && cat "$HOME/.ibctest/logs/ibctest.log" && exit 1) + run: (go test -race -timeout 30m -v -p 2 ./cmd/interchaintest) || (echo "\n\n*****CHAIN and RELAYER LOGS*****" && cat "$HOME/.interchaintest/logs/interchaintest.log" && exit 1) test-ibc-examples: name: test-ibc-examples runs-on: [self-hosted, linux] @@ -64,13 +64,13 @@ jobs: with: go-version: 1.19 - - name: checkout ibctest + - name: checkout interchaintest uses: actions/checkout@v3 # cleanup environment on self-hosted test runner - name: clean run: |- - rm -rf ~/.ibctest + rm -rf ~/.interchaintest # run tests - name: run example ibc tests @@ -85,13 +85,13 @@ jobs: with: go-version: 1.19 - - name: checkout ibctest + - name: checkout interchaintest uses: actions/checkout@v3 # cleanup environment on self-hosted test runner - name: clean run: |- - rm -rf ~/.ibctest + rm -rf ~/.interchaintest # run tests - name: run example cosmos tests diff --git a/.gitignore b/.gitignore index cb53a9ff0..dff1bd8a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# Don't commit the ibctest.test file, +# Don't commit the interchaintest.test file, # regardless of where it was built. -ibctest.test +interchaintest.test /bin .idea diff --git a/Makefile b/Makefile index 05d1ca4e2..6c9a6c720 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,16 @@ default: help help: ## Print this help message @echo "Available make commands:"; grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -.PHONY: ibctest -ibctest: gen ## Build ibctest binary into ./bin - go test -ldflags "-X github.com/strangelove-ventures/ibctest/v7/internal/version.GitSha=$(shell git describe --always --dirty)" -c -o ./bin/ibctest ./cmd/ibctest +.PHONY: interchaintest +interchaintest: gen ## Build interchaintest binary into ./bin + go test -ldflags "-X github.com/strangelove-ventures/interchaintest/v7/internal/version.GitSha=$(shell git describe --always --dirty)" -c -o ./bin/interchaintest ./cmd/interchaintest .PHONY: test test: ## Run unit tests @go test -cover -short -race -timeout=60s ./... .PHONY: docker-reset -docker-reset: ## Attempt to delete all running containers. Useful if ibctest does not exit cleanly. +docker-reset: ## Attempt to delete all running containers. Useful if interchaintest does not exit cleanly. @docker stop $(shell docker ps -q) &>/dev/null || true @docker rm --force $(shell docker ps -q) &>/dev/null || true diff --git a/README.md b/README.md index 71ccb38bb..24896f92e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@
-

ibctest

+

interchaintest

-[![Go Reference](https://pkg.go.dev/badge/github.com/strangelove-ventures/ibctest@main.svg)](https://pkg.go.dev/github.com/strangelove-ventures/ibctest@main) -[![License: Apache-2.0](https://img.shields.io/github/license/strangelove-ventures/ibctest.svg?style=flat-square)](https://github.com/strangelove-ventures/ibctest/blob/main/create-test-readme/LICENSE) -[![Go Report Card](https://goreportcard.com/badge/github.com/strangelove-ventures/ibctest)](https://goreportcard.com/report/github.com/strangelove-ventures/ibctest) +Formerly known as `ibctest`. +[![Go Reference](https://pkg.go.dev/badge/github.com/strangelove-ventures/interchaintest@main.svg)](https://pkg.go.dev/github.com/strangelove-ventures/interchaintest@main) +[![License: Apache-2.0](https://img.shields.io/github/license/strangelove-ventures/interchaintest.svg?style=flat-square)](https://github.com/strangelove-ventures/interchaintest/blob/main/create-test-readme/LICENSE) +[![Go Report Card](https://goreportcard.com/badge/github.com/strangelove-ventures/interchaintest)](https://goreportcard.com/report/github.com/strangelove-ventures/interchaintest) -`ibctest` orchestrates Go tests that utilize Docker containers for multiple + +`interchaintest` orchestrates Go tests that utilize Docker containers for multiple [IBC](https://docs.cosmos.network/master/ibc/overview.html)-compatible blockchains. -It allows users to quickly spin up custom testnets and dev environments to test IBC and chain infrastructures. +It allows users to quickly spin up custom testnets and dev environments to test IBC, chain infrastructures, smart contracts, etc.
### -- Features -- @@ -39,12 +41,12 @@ While it is not necessary to build the binary, sometimes it can be more convenie Building binary: ```shell -git clone https://github.com/strangelove-ventures/ibctest.git -cd ibctest -make ibctest +git clone https://github.com/strangelove-ventures/interchaintest.git +cd interchaintest +make interchaintest ``` -This places the binary in `ibctest/.bin/ibctest` +This places the binary in `interchaintest/.bin/interchaintest` Note that this is not in your Go path. @@ -57,7 +59,7 @@ Please read the [logging style guide](./docs/logging.md). ## Trophies -Significant bugs that were more easily fixed with `ibctest`: +Significant bugs that were more easily fixed with `interchaintest`: -- [Juno network halt reproduction](https://github.com/strangelove-ventures/ibctest/pull/7) -- [Juno network halt fix confirmation](https://github.com/strangelove-ventures/ibctest/pull/8) \ No newline at end of file +- [Juno network halt reproduction](https://github.com/strangelove-ventures/interchaintest/pull/7) +- [Juno network halt fix confirmation](https://github.com/strangelove-ventures/interchaintest/pull/8) \ No newline at end of file diff --git a/chain/cosmos/broadcaster.go b/chain/cosmos/broadcaster.go index f121e02dd..294e77c1a 100644 --- a/chain/cosmos/broadcaster.go +++ b/chain/cosmos/broadcaster.go @@ -16,8 +16,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx/signing" authTx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/testutil" ) type ClientContextOpt func(clientContext client.Context) client.Context @@ -174,7 +174,7 @@ func (b *Broadcaster) defaultTxFactory(clientCtx client.Context, accountNumber u WithGasAdjustment(chainConfig.GasAdjustment). WithGas(flags.DefaultGasLimit). WithGasPrices(chainConfig.GasPrices). - WithMemo("ibctest"). + WithMemo("interchaintest"). WithTxConfig(clientCtx.TxConfig). WithAccountRetriever(clientCtx.AccountRetriever). WithKeybase(clientCtx.Keyring). diff --git a/chain/cosmos/chain_node.go b/chain/cosmos/chain_node.go index d3b2090d6..8ac5e9d86 100644 --- a/chain/cosmos/chain_node.go +++ b/chain/cosmos/chain_node.go @@ -27,10 +27,10 @@ import ( dockerclient "github.com/docker/docker/client" "github.com/docker/docker/errdefs" "github.com/docker/go-connections/nat" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/testutil" tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/p2p" rpcclient "github.com/tendermint/tendermint/rpc/client" @@ -195,7 +195,7 @@ func (tn *ChainNode) HomeDir() string { return path.Join("/var/cosmos-chain", tn.Chain.Config().Name) } -// SetTestConfig modifies the config to reasonable values for use within ibctest. +// SetTestConfig modifies the config to reasonable values for use within interchaintest. func (tn *ChainNode) SetTestConfig(ctx context.Context) error { c := make(testutil.Toml) diff --git a/chain/cosmos/cosmos_chain.go b/chain/cosmos/cosmos_chain.go index 87f87834d..c8f992f76 100644 --- a/chain/cosmos/cosmos_chain.go +++ b/chain/cosmos/cosmos_chain.go @@ -24,11 +24,11 @@ import ( dockertypes "github.com/docker/docker/api/types" volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/chain/internal/tendermint" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/chain/internal/tendermint" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "go.uber.org/zap" "golang.org/x/sync/errgroup" "google.golang.org/grpc" diff --git a/chain/cosmos/node_test.go b/chain/cosmos/node_test.go index fbf2d88bd..d4b4a9b54 100644 --- a/chain/cosmos/node_test.go +++ b/chain/cosmos/node_test.go @@ -5,7 +5,7 @@ import ( "testing" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/stretchr/testify/require" ) diff --git a/chain/cosmos/osmosis.go b/chain/cosmos/osmosis.go index 7aa629dda..330460af2 100644 --- a/chain/cosmos/osmosis.go +++ b/chain/cosmos/osmosis.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" ) // OsmosisPoolParams defines parameters for creating an osmosis gamm liquidity pool diff --git a/chain/cosmos/poll.go b/chain/cosmos/poll.go index d41343d6a..9bd141ac7 100644 --- a/chain/cosmos/poll.go +++ b/chain/cosmos/poll.go @@ -6,8 +6,8 @@ import ( "fmt" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testutil" ) // PollForProposalStatus attempts to find a proposal with matching ID and status. diff --git a/chain/cosmos/wallet.go b/chain/cosmos/wallet.go index 7066aaa26..d6caf15c8 100644 --- a/chain/cosmos/wallet.go +++ b/chain/cosmos/wallet.go @@ -2,7 +2,7 @@ package cosmos import ( "github.com/cosmos/cosmos-sdk/types" - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) var _ ibc.Wallet = &CosmosWallet{} diff --git a/chain/internal/tendermint/tendermint_node.go b/chain/internal/tendermint/tendermint_node.go index 87d84c3d2..0948ca9c2 100644 --- a/chain/internal/tendermint/tendermint_node.go +++ b/chain/internal/tendermint/tendermint_node.go @@ -14,9 +14,9 @@ import ( dockerclient "github.com/docker/docker/client" "github.com/docker/go-connections/nat" "github.com/hashicorp/go-version" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/testutil" tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/p2p" rpcclient "github.com/tendermint/tendermint/rpc/client" diff --git a/chain/penumbra/penumbra_app_node.go b/chain/penumbra/penumbra_app_node.go index 22443280c..e9f445d69 100644 --- a/chain/penumbra/penumbra_app_node.go +++ b/chain/penumbra/penumbra_app_node.go @@ -13,8 +13,8 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" "github.com/docker/go-connections/nat" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "go.uber.org/zap" ) @@ -67,7 +67,20 @@ func (p *PenumbraAppNode) HomeDir() string { } func (p *PenumbraAppNode) CreateKey(ctx context.Context, keyName string) error { - cmd := []string{"pcli", "-d", p.HomeDir(), "wallet", "generate"} + keyPath := filepath.Join(p.HomeDir(), "keys", keyName) + cmd := []string{"pcli", "-d", keyPath, "keys", "generate"} + _, stderr, err := p.Exec(ctx, cmd, nil) + // already exists error is okay + if err != nil && !strings.Contains(string(stderr), "already exists, refusing to overwrite it") { + return err + } + return nil +} + +// RecoverKey restores a key from a given mnemonic. +func (p *PenumbraAppNode) RecoverKey(ctx context.Context, keyName, mnemonic string) error { + keyPath := filepath.Join(p.HomeDir(), "keys", keyName) + cmd := []string{"pcli", "-d", keyPath, "keys", "import", "phrase", mnemonic} _, stderr, err := p.Exec(ctx, cmd, nil) // already exists error is okay if err != nil && !strings.Contains(string(stderr), "already exists, refusing to overwrite it") { @@ -78,10 +91,11 @@ func (p *PenumbraAppNode) CreateKey(ctx context.Context, keyName string) error { // initializes validator definition template file // wallet must be generated first -func (p *PenumbraAppNode) InitValidatorFile(ctx context.Context) error { +func (p *PenumbraAppNode) InitValidatorFile(ctx context.Context, valKeyName string) error { + keyPath := filepath.Join(p.HomeDir(), "keys", valKeyName) cmd := []string{ "pcli", - "-d", p.HomeDir(), + "-d", keyPath, "validator", "definition", "template", "--file", p.ValidatorDefinitionTemplateFilePathContainer(), } diff --git a/chain/penumbra/penumbra_chain.go b/chain/penumbra/penumbra_chain.go index ea4409038..b9d016049 100644 --- a/chain/penumbra/penumbra_chain.go +++ b/chain/penumbra/penumbra_chain.go @@ -17,10 +17,10 @@ import ( "github.com/docker/docker/api/types" volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/chain/internal/tendermint" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/chain/internal/tendermint" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "go.uber.org/zap" "golang.org/x/sync/errgroup" ) @@ -143,7 +143,7 @@ func (c *PenumbraChain) CreateKey(ctx context.Context, keyName string) error { } func (c *PenumbraChain) RecoverKey(ctx context.Context, name, mnemonic string) error { - return fmt.Errorf("RecoverKey not implemented for PenumbraChain") + return c.getRelayerNode().PenumbraAppNode.RecoverKey(ctx, name, mnemonic) } // Implements Chain interface @@ -375,7 +375,7 @@ func (c *PenumbraChain) Start(testName string, ctx context.Context, additionalGe if err := v.PenumbraAppNode.CreateKey(egCtx, valKey); err != nil { return fmt.Errorf("error generating wallet on penumbra node: %v", err) } - if err := v.PenumbraAppNode.InitValidatorFile(egCtx); err != nil { + if err := v.PenumbraAppNode.InitValidatorFile(egCtx, valKey); err != nil { return fmt.Errorf("error initializing validator template on penumbra node: %v", err) } diff --git a/chain/penumbra/wallet.go b/chain/penumbra/wallet.go index d7754188a..4823ed388 100644 --- a/chain/penumbra/wallet.go +++ b/chain/penumbra/wallet.go @@ -2,7 +2,7 @@ package penumbra import ( "github.com/cosmos/cosmos-sdk/types" - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) var _ ibc.Wallet = &PenumbraWallet{} diff --git a/chain/polkadot/keys_test.go b/chain/polkadot/keys_test.go index 5ba176e02..392d714cd 100644 --- a/chain/polkadot/keys_test.go +++ b/chain/polkadot/keys_test.go @@ -8,7 +8,7 @@ import ( "github.com/centrifuge/go-substrate-rpc-client/v4/signature" p2pCrypto "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/peer" - "github.com/strangelove-ventures/ibctest/v7/chain/polkadot" + "github.com/strangelove-ventures/interchaintest/v7/chain/polkadot" "github.com/stretchr/testify/require" ) diff --git a/chain/polkadot/parachain_node.go b/chain/polkadot/parachain_node.go index a89cd1c49..fca4bf58e 100644 --- a/chain/polkadot/parachain_node.go +++ b/chain/polkadot/parachain_node.go @@ -17,8 +17,8 @@ import ( "github.com/icza/dyno" p2pcrypto "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/peer" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "go.uber.org/zap" ) diff --git a/chain/polkadot/polkadot_chain.go b/chain/polkadot/polkadot_chain.go index 355678c76..1e384e2bf 100644 --- a/chain/polkadot/polkadot_chain.go +++ b/chain/polkadot/polkadot_chain.go @@ -19,8 +19,8 @@ import ( "github.com/docker/docker/client" "github.com/icza/dyno" p2pcrypto "github.com/libp2p/go-libp2p-core/crypto" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "go.uber.org/zap" "golang.org/x/sync/errgroup" ) diff --git a/chain/polkadot/polkadot_chain_test.go b/chain/polkadot/polkadot_chain_test.go index 725beef98..beb065491 100644 --- a/chain/polkadot/polkadot_chain_test.go +++ b/chain/polkadot/polkadot_chain_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -16,7 +16,7 @@ func TestWalletMethods(t *testing.T) { nv := 5 nf := 3 - chains, err := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + chains, err := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { ChainConfig: ibc.ChainConfig{ Type: "polkadot", diff --git a/chain/polkadot/relay_chain_node.go b/chain/polkadot/relay_chain_node.go index 41cf14e8b..3297a6d17 100644 --- a/chain/polkadot/relay_chain_node.go +++ b/chain/polkadot/relay_chain_node.go @@ -20,8 +20,8 @@ import ( "go.uber.org/zap" "github.com/decred/dcrd/dcrec/secp256k1/v2" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" ) // RelayChainNode defines the properties required for running a polkadot relay chain node. diff --git a/chain/polkadot/tx.go b/chain/polkadot/tx.go index 8d36c19ab..a0541b919 100644 --- a/chain/polkadot/tx.go +++ b/chain/polkadot/tx.go @@ -6,7 +6,7 @@ import ( gsrpc "github.com/centrifuge/go-substrate-rpc-client/v4" "github.com/centrifuge/go-substrate-rpc-client/v4/signature" gstypes "github.com/centrifuge/go-substrate-rpc-client/v4/types" - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) // SendFundsTx sends funds to a wallet using the SubstrateAPI diff --git a/chain/polkadot/wallet.go b/chain/polkadot/wallet.go index 81688f2f7..767aace28 100644 --- a/chain/polkadot/wallet.go +++ b/chain/polkadot/wallet.go @@ -1,7 +1,7 @@ package polkadot import ( - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) var _ ibc.Wallet = &PolkadotWallet{} diff --git a/chainfactory.go b/chainfactory.go index 93c92a7d7..2f8fccacd 100644 --- a/chainfactory.go +++ b/chainfactory.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( _ "embed" @@ -7,11 +7,11 @@ import ( "strings" "sync" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/chain/penumbra" - "github.com/strangelove-ventures/ibctest/v7/chain/polkadot" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/chain/penumbra" + "github.com/strangelove-ventures/interchaintest/v7/chain/polkadot" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/label" "go.uber.org/zap" "gopkg.in/yaml.v3" ) diff --git a/chainset.go b/chainset.go index caf775f3b..35502413e 100644 --- a/chainset.go +++ b/chainset.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "context" @@ -9,8 +9,8 @@ import ( "time" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" "go.uber.org/multierr" "go.uber.org/zap" "golang.org/x/sync/errgroup" diff --git a/chainspec.go b/chainspec.go index efc68590b..a32f070d8 100644 --- a/chainspec.go +++ b/chainspec.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "errors" @@ -8,8 +8,8 @@ import ( "sync" "sync/atomic" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/label" "go.uber.org/zap" ) diff --git a/chainspec_test.go b/chainspec_test.go index c5b168a88..cbf0b21b5 100644 --- a/chainspec_test.go +++ b/chainspec_test.go @@ -1,19 +1,19 @@ -package ibctest_test +package interchaintest_test import ( "regexp" "testing" "github.com/google/go-cmp/cmp" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) func TestChainSpec_Config(t *testing.T) { t.Run("valid", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Name: "gaia", Version: "v7.0.1", @@ -24,7 +24,7 @@ func TestChainSpec_Config(t *testing.T) { }) t.Run("omit name when all other fields provided", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ ChainName: "mychain", ChainConfig: ibc.ChainConfig{ @@ -48,7 +48,7 @@ func TestChainSpec_Config(t *testing.T) { }) t.Run("consistently generated config", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Name: "gaia", Version: "v7.0.1", @@ -66,7 +66,7 @@ func TestChainSpec_Config(t *testing.T) { t.Run("name and chain ID generation", func(t *testing.T) { t.Run("same name and chain ID generated when ChainName and ChainID omitted", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Name: "gaia", Version: "v7.0.1", @@ -80,7 +80,7 @@ func TestChainSpec_Config(t *testing.T) { }) t.Run("chain ID generated from ChainName, when ChainName provided", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Name: "gaia", ChainName: "mychain", @@ -96,7 +96,7 @@ func TestChainSpec_Config(t *testing.T) { }) t.Run("overrides", func(t *testing.T) { - baseSpec := &ibctest.ChainSpec{ + baseSpec := &interchaintest.ChainSpec{ Name: "gaia", Version: "v7.0.1", @@ -137,7 +137,7 @@ func TestChainSpec_Config(t *testing.T) { t.Run("error cases", func(t *testing.T) { t.Run("version required", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Name: "gaia", } @@ -146,7 +146,7 @@ func TestChainSpec_Config(t *testing.T) { }) t.Run("name required", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Version: "v1.2.3", } @@ -155,7 +155,7 @@ func TestChainSpec_Config(t *testing.T) { }) t.Run("name invalid", func(t *testing.T) { - s := ibctest.ChainSpec{ + s := interchaintest.ChainSpec{ Name: "invalid_chain", Version: "v1.2.3", } diff --git a/cmd/ibctest/README.md b/cmd/interchaintest/README.md similarity index 97% rename from cmd/ibctest/README.md rename to cmd/interchaintest/README.md index 75634e6fd..a14f2bfc2 100644 --- a/cmd/ibctest/README.md +++ b/cmd/interchaintest/README.md @@ -1,4 +1,4 @@ -# ibctest +# interchaintest This directory contains a test that can be parameterized at runtime, allowing a user to pick and choose what combinations of relayers and chains to test. diff --git a/cmd/ibctest/example_matrix.json b/cmd/interchaintest/example_matrix.json similarity index 100% rename from cmd/ibctest/example_matrix.json rename to cmd/interchaintest/example_matrix.json diff --git a/cmd/ibctest/example_matrix_custom.json b/cmd/interchaintest/example_matrix_custom.json similarity index 100% rename from cmd/ibctest/example_matrix_custom.json rename to cmd/interchaintest/example_matrix_custom.json diff --git a/cmd/ibctest/flags.go b/cmd/interchaintest/flags.go similarity index 91% rename from cmd/ibctest/flags.go rename to cmd/interchaintest/flags.go index 0015356a4..b291dab01 100644 --- a/cmd/ibctest/flags.go +++ b/cmd/interchaintest/flags.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "fmt" @@ -6,7 +6,7 @@ import ( "os" "time" - ibctest "github.com/strangelove-ventures/ibctest/v7" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) @@ -31,7 +31,7 @@ func (f mainFlags) Logger() (lc LoggerCloser, _ error) { w = os.Stdout lc.FilePath = "stdout" default: - file, err := ibctest.CreateLogFile(f.LogFile) + file, err := interchaintest.CreateLogFile(f.LogFile) if err != nil { return lc, fmt.Errorf("create log file: %w", err) } diff --git a/cmd/ibctest/flags_test.go b/cmd/interchaintest/flags_test.go similarity index 94% rename from cmd/ibctest/flags_test.go rename to cmd/interchaintest/flags_test.go index e7809b3db..6cde2d6b3 100644 --- a/cmd/ibctest/flags_test.go +++ b/cmd/interchaintest/flags_test.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "testing" diff --git a/cmd/ibctest/ibctest_test.go b/cmd/interchaintest/interchaintest_test.go similarity index 78% rename from cmd/ibctest/ibctest_test.go rename to cmd/interchaintest/interchaintest_test.go index bcaed542c..76625105a 100644 --- a/cmd/ibctest/ibctest_test.go +++ b/cmd/interchaintest/interchaintest_test.go @@ -1,5 +1,5 @@ -// Command ibctest allows running the relayer tests with command-line configuration. -package ibctest +// Command interchaintest allows running the relayer tests with command-line configuration. +package interchaintest import ( "context" @@ -13,14 +13,14 @@ import ( "time" "github.com/rivo/tview" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/conformance" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" - blockdbtui "github.com/strangelove-ventures/ibctest/v7/internal/blockdb/tui" - "github.com/strangelove-ventures/ibctest/v7/internal/version" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/conformance" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" + blockdbtui "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb/tui" + "github.com/strangelove-ventures/interchaintest/v7/internal/version" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "go.uber.org/zap" ) @@ -45,7 +45,7 @@ func init() { var testMatrix struct { Relayers []string - ChainSets [][]*ibctest.ChainSpec + ChainSets [][]*interchaintest.ChainSpec } var debugFlagSet = flag.NewFlagSet("debug", flag.ExitOnError) @@ -104,7 +104,7 @@ func setUpTestMatrix() error { fmt.Fprintln(os.Stderr, "No matrix file provided, falling back to rly with gaia and osmosis") testMatrix.Relayers = []string{"rly"} - testMatrix.ChainSets = [][]*ibctest.ChainSpec{ + testMatrix.ChainSets = [][]*interchaintest.ChainSpec{ { {Name: "gaia", Version: "v7.0.1"}, {Name: "osmosis", Version: "v7.2.0"}, @@ -152,7 +152,7 @@ func configureTestReporter() error { if err != nil { return fmt.Errorf("failed to get user home dir: %w", err) } - fpath := filepath.Join(home, ".ibctest", "reports") + fpath := filepath.Join(home, ".interchaintest", "reports") err = os.MkdirAll(fpath, 0755) if err != nil { return fmt.Errorf("mkdirall: %w", err) @@ -169,22 +169,22 @@ func configureTestReporter() error { return nil } -func getRelayerFactory(name string, logger *zap.Logger) (ibctest.RelayerFactory, error) { +func getRelayerFactory(name string, logger *zap.Logger) (interchaintest.RelayerFactory, error) { switch name { case "rly", "cosmos/relayer": - return ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, relayer.StartupFlags("-b", "100")), nil + return interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, relayer.StartupFlags("-b", "100")), nil case "hermes": - return ibctest.NewBuiltinRelayerFactory(ibc.Hermes, logger), nil + return interchaintest.NewBuiltinRelayerFactory(ibc.Hermes, logger), nil default: return nil, fmt.Errorf("unknown relayer type %q (valid types: rly, hermes)", name) } } -func getChainFactory(log *zap.Logger, chainSpecs []*ibctest.ChainSpec) (ibctest.ChainFactory, error) { +func getChainFactory(log *zap.Logger, chainSpecs []*interchaintest.ChainSpec) (interchaintest.ChainFactory, error) { if len(chainSpecs) != 2 { return nil, fmt.Errorf("chain specs must have length 2 (found a chain set of length %d)", len(chainSpecs)) } - return ibctest.NewBuiltinChainFactory(log, chainSpecs), nil + return interchaintest.NewBuiltinChainFactory(log, chainSpecs), nil } // TestConformance is the root test for the ibc conformance tests. @@ -210,7 +210,7 @@ func TestConformance(t *testing.T) { log := logger.Logger // Build a set of chain factories from the provided chain sets. - chainFactories := make([]ibctest.ChainFactory, 0, len(testMatrix.ChainSets)) + chainFactories := make([]interchaintest.ChainFactory, 0, len(testMatrix.ChainSets)) for _, cs := range testMatrix.ChainSets { cf, err := getChainFactory(log, cs) if err != nil { @@ -221,7 +221,7 @@ func TestConformance(t *testing.T) { } // Materialize all the relayer factories. - relayerFactories := make([]ibctest.RelayerFactory, len(testMatrix.Relayers)) + relayerFactories := make([]interchaintest.RelayerFactory, len(testMatrix.Relayers)) for i, r := range testMatrix.Relayers { rf, err := getRelayerFactory(r, log) if err != nil { @@ -243,12 +243,12 @@ func TestConformance(t *testing.T) { // We can revisit if necessary. func addFlags() { flag.StringVar(&extraFlags.MatrixFile, "matrix", "", "Path to matrix file defining what configurations to test") - flag.StringVar(&extraFlags.LogFile, "log-file", "ibctest.log", "File to write chain and relayer logs. If a file name, logs written to $HOME/.ibctest/logs directory. Use 'stderr' or 'stdout' to print logs in line tests.") + flag.StringVar(&extraFlags.LogFile, "log-file", "interchaintest.log", "File to write chain and relayer logs. If a file name, logs written to $HOME/.interchaintest/logs directory. Use 'stderr' or 'stdout' to print logs in line tests.") flag.StringVar(&extraFlags.LogFormat, "log-format", "console", "Chain and relayer log format: console|json") flag.StringVar(&extraFlags.LogLevel, "log-level", "info", "Chain and relayer log level: debug|info|error") - flag.StringVar(&extraFlags.ReportFile, "report-file", "", "Path where test report will be stored. Defaults to $HOME/.ibctest/reports/$TIMESTAMP.json") + flag.StringVar(&extraFlags.ReportFile, "report-file", "", "Path where test report will be stored. Defaults to $HOME/.interchaintest/reports/$TIMESTAMP.json") - debugFlagSet.StringVar(&extraFlags.BlockDatabaseFile, "block-db", ibctest.DefaultBlockDatabaseFilepath(), "Path to database sqlite file that tracks blocks and transactions.") + debugFlagSet.StringVar(&extraFlags.BlockDatabaseFile, "block-db", interchaintest.DefaultBlockDatabaseFilepath(), "Path to database sqlite file that tracks blocks and transactions.") } func parseFlags() { diff --git a/cmd/ibctest/matrix_test.go b/cmd/interchaintest/matrix_test.go similarity index 86% rename from cmd/ibctest/matrix_test.go rename to cmd/interchaintest/matrix_test.go index 9bc8c9814..c06e98d73 100644 --- a/cmd/ibctest/matrix_test.go +++ b/cmd/interchaintest/matrix_test.go @@ -1,11 +1,11 @@ -package ibctest_test +package interchaintest_test import ( _ "embed" "encoding/json" "testing" - ibctest "github.com/strangelove-ventures/ibctest/v7" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -21,7 +21,7 @@ var ( func TestMatrixValid(t *testing.T) { type matrix struct { - ChainSets [][]*ibctest.ChainSpec + ChainSets [][]*interchaintest.ChainSpec } for _, tc := range []struct { diff --git a/configuredChains.yaml b/configuredChains.yaml index 3f5072928..a1409cb20 100644 --- a/configuredChains.yaml +++ b/configuredChains.yaml @@ -1,4 +1,4 @@ -## NOTICE: This file gets embedded into ibctest binary. +## NOTICE: This file gets embedded into interchaintest binary. ## Set the environment variable: IBCTEST_CONFIGURED_CHAINS to a path ## to use custom versions of this file diff --git a/conformance/flush.go b/conformance/flush.go index e27ad83de..69fcfe579 100644 --- a/conformance/flush.go +++ b/conformance/flush.go @@ -6,22 +6,22 @@ import ( "testing" "github.com/cosmos/cosmos-sdk/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" ) -func TestRelayerFlushing(t *testing.T, ctx context.Context, cf ibctest.ChainFactory, rf ibctest.RelayerFactory, rep *testreporter.Reporter) { +func TestRelayerFlushing(t *testing.T, ctx context.Context, cf interchaintest.ChainFactory, rf interchaintest.RelayerFactory, rep *testreporter.Reporter) { rep.TrackTest(t) // FlushPackets will be exercised in a subtest, // but check that capability first in case we can avoid setup. requireCapabilities(t, rep, rf, relayer.FlushPackets) - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) req := require.New(rep.TestifyT(t)) chains, err := cf.Chains(t.Name()) @@ -36,11 +36,11 @@ func TestRelayerFlushing(t *testing.T, ctx context.Context, cf ibctest.ChainFact r := rf.Build(t, client, network) const pathName = "p" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(c0). AddChain(c1). AddRelayer(r, "r"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: c0, Chain2: c1, Relayer: r, @@ -51,7 +51,7 @@ func TestRelayerFlushing(t *testing.T, ctx context.Context, cf ibctest.ChainFact eRep := rep.RelayerExecReporter(t) - req.NoError(ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + req.NoError(ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -59,7 +59,7 @@ func TestRelayerFlushing(t *testing.T, ctx context.Context, cf ibctest.ChainFact defer ic.Close() // Get faucet address on destination chain for ibc transfer. - c1FaucetAddrBytes, err := c1.GetAddress(ctx, ibctest.FaucetAccountKeyName) + c1FaucetAddrBytes, err := c1.GetAddress(ctx, interchaintest.FaucetAccountKeyName) req.NoError(err) c1FaucetAddr, err := types.Bech32ifyAddressBytes(c1.Config().Bech32Prefix, c1FaucetAddrBytes) req.NoError(err) @@ -75,7 +75,7 @@ func TestRelayerFlushing(t *testing.T, ctx context.Context, cf ibctest.ChainFact req.NoError(err) const txAmount = 112233 // Arbitrary amount that is easy to find in logs. - tx, err := c0.SendIBCTransfer(ctx, c0ChannelID, ibctest.FaucetAccountKeyName, ibc.WalletAmount{ + tx, err := c0.SendIBCTransfer(ctx, c0ChannelID, interchaintest.FaucetAccountKeyName, ibc.WalletAmount{ Address: c1FaucetAddr, Denom: c0.Config().Denom, Amount: txAmount, diff --git a/conformance/relayersetup.go b/conformance/relayersetup.go index d0bf2c456..7e9e9702c 100644 --- a/conformance/relayersetup.go +++ b/conformance/relayersetup.go @@ -6,19 +6,19 @@ import ( "testing" conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) // TestRelayerSetup contains a series of subtests that configure a relayer step-by-step. -func TestRelayerSetup(t *testing.T, ctx context.Context, cf ibctest.ChainFactory, rf ibctest.RelayerFactory, rep *testreporter.Reporter) { +func TestRelayerSetup(t *testing.T, ctx context.Context, cf interchaintest.ChainFactory, rf interchaintest.RelayerFactory, rep *testreporter.Reporter) { rep.TrackTest(t) - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) req := require.New(rep.TestifyT(t)) chains, err := cf.Chains(t.Name()) @@ -33,11 +33,11 @@ func TestRelayerSetup(t *testing.T, ctx context.Context, cf ibctest.ChainFactory r := rf.Build(t, client, network) const pathName = "p" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(c0). AddChain(c1). AddRelayer(r, "r"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ // We are adding a link here so that the interchain object creates appropriate relayer wallets, // but we call ic.Build with SkipPathCreation=true, so the link won't be created. Chain1: c0, @@ -49,7 +49,7 @@ func TestRelayerSetup(t *testing.T, ctx context.Context, cf ibctest.ChainFactory eRep := rep.RelayerExecReporter(t) - req.NoError(ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + req.NoError(ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, diff --git a/conformance/test.go b/conformance/test.go index 6f042be75..51d8d0ebb 100644 --- a/conformance/test.go +++ b/conformance/test.go @@ -14,8 +14,8 @@ // import ( // "testing" // -// "github.com/strangelove-ventures/ibctest/v7/conformance" -// "github.com/strangelove-ventures/ibctest/v7/ibc" +// "github.com/strangelove-ventures/interchaintest/v7/conformance" +// "github.com/strangelove-ventures/interchaintest/v7/ibc" // ) // // func TestMyRelayer(t *testing.T) { @@ -25,7 +25,7 @@ // } // // Although the conformance package is made available as a convenience for other projects, -// the ibctest project should be considered the canonical definition of tests and configuration. +// the interchaintest project should be considered the canonical definition of tests and configuration. package conformance import ( @@ -37,14 +37,14 @@ import ( transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" "github.com/docker/docker/client" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/label" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) @@ -111,7 +111,7 @@ var relayerTestCaseConfigs = [...]RelayerTestCaseConfig{ } // requireCapabilities tracks skipping t, if the relayer factory cannot satisfy the required capabilities. -func requireCapabilities(t *testing.T, rep *testreporter.Reporter, rf ibctest.RelayerFactory, reqCaps ...relayer.Capability) { +func requireCapabilities(t *testing.T, rep *testreporter.Reporter, rf interchaintest.RelayerFactory, reqCaps ...relayer.Capability) { t.Helper() missing := missingCapabilities(rf, reqCaps...) @@ -121,7 +121,7 @@ func requireCapabilities(t *testing.T, rep *testreporter.Reporter, rf ibctest.Re } } -func missingCapabilities(rf ibctest.RelayerFactory, reqCaps ...relayer.Capability) []relayer.Capability { +func missingCapabilities(rf interchaintest.RelayerFactory, reqCaps ...relayer.Capability) []relayer.Capability { caps := rf.Capabilities() var missing []relayer.Capability for _, c := range reqCaps { @@ -213,7 +213,7 @@ func sendIBCTransfersFromBothChainsWithTimeout( // so that it can properly group subtests in a single invocation. // If the subtest configuration does not meet your needs, // you can directly call one of the other exported Test functions, such as TestChainPair. -func Test(t *testing.T, ctx context.Context, cfs []ibctest.ChainFactory, rfs []ibctest.RelayerFactory, rep *testreporter.Reporter) { +func Test(t *testing.T, ctx context.Context, cfs []interchaintest.ChainFactory, rfs []interchaintest.RelayerFactory, rep *testreporter.Reporter) { // Validate chain factory counts up front. counts := make(map[int]bool) for _, cf := range cfs { @@ -259,7 +259,7 @@ func Test(t *testing.T, ctx context.Context, cfs []ibctest.ChainFactory, rfs []i panic(fmt.Errorf("failed to get chains: %v", err)) } - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) TestChainPair(t, ctx, client, network, chains[0], chains[1], rf, rep, nil) }) @@ -292,7 +292,7 @@ func TestChainPair( client *client.Client, network string, srcChain, dstChain ibc.Chain, - rf ibctest.RelayerFactory, + rf interchaintest.RelayerFactory, rep *testreporter.Reporter, relayerImpl ibc.Relayer, pathNames ...string, @@ -320,7 +320,7 @@ func TestChainPair( } preRelayerStartFunc := func(channels []ibc.ChannelOutput) { // fund a user wallet on both chains, save on test case - testCase.Users = ibctest.GetAndFundTestUsers(t, ctx, strings.ReplaceAll(testCase.Config.Name, " ", "-")+"-"+randomSuffix, userFaucetFund, srcChain, dstChain) + testCase.Users = interchaintest.GetAndFundTestUsers(t, ctx, strings.ReplaceAll(testCase.Config.Name, " ", "-")+"-"+randomSuffix, userFaucetFund, srcChain, dstChain) // run test specific pre relayer start action testCase.Config.PreRelayerStart(ctx, t, &testCase, srcChain, dstChain, channels) } @@ -333,12 +333,12 @@ func TestChainPair( // funds relayer src and dst wallets on respective chain in genesis. // creates a faucet account on the both chains (separate fullnode). // funds faucet accounts in genesis. - relayerImpl, err = ibctest.StartChainPair(t, ctx, rep, client, network, srcChain, dstChain, rf, preRelayerStartFuncs) + relayerImpl, err = interchaintest.StartChainPair(t, ctx, rep, client, network, srcChain, dstChain, rf, preRelayerStartFuncs) req.NoError(err, "failed to StartChainPair") } // execute the pre relayer start functions, then start the relayer. - channels, err := ibctest.StopStartRelayerWithPreStartFuncs( + channels, err := interchaintest.StopStartRelayerWithPreStartFuncs( t, ctx, srcChain.Config().ChainID, diff --git a/docs/ciTests.md b/docs/ciTests.md index 965ae08fd..a5cbb0be6 100644 --- a/docs/ciTests.md +++ b/docs/ciTests.md @@ -1,5 +1,5 @@ # Integrate Tests Into Github Client ### Example implementatios: -- Go Relayer - https://github.com/cosmos/relayer/blob/main/.github/workflows/ibctest.yml +- Go Relayer - https://github.com/cosmos/relayer/blob/main/.github/workflows/interchaintest.yml - IBC-Go e2e tests - https://github.com/cosmos/ibc-go/blob/main/.github/workflows/e2e-test-workflow-call.yml \ No newline at end of file diff --git a/docs/conformanceTests.md b/docs/conformanceTests.md index 3f99b9029..26d782f6d 100644 --- a/docs/conformanceTests.md +++ b/docs/conformanceTests.md @@ -1,6 +1,6 @@ # Conformance Tests -`ibctest` comes with a suite of conformance tests. These tests ensure IBC and relayer compatibility. On a high-level it tests: +`interchaintest` comes with a suite of conformance tests. These tests ensure IBC and relayer compatibility. On a high-level it tests: - `client`, `channel`, and `connection` creation - messages are properly relayed and acknowledged - packets are being properly timed out @@ -10,24 +10,24 @@ You can view all the specific conformance test by reviewing them in the [conform ### Default Environment To run conformance tests with the default chain and relayer configuration (gaiad <-> osmosisd with the Go Relayer), run the binary without any extra arguments: ```shell -ibctest +interchaintest ``` To run same tests from source code: ```shell -go test -v ./cmd/ibctest/ +go test -v ./cmd/interchaintest/ ``` ### Custom Environment Using the binary allows for easy custom chain pairs and custom testing environments. This is accomplished via the `-matrix` argument. ```shell -ibctest -matrix +interchaintest -matrix ``` **Example Matrix Files:** -- [example_matrix.json](../cmd/ibctest/example_matrix.json) - Basic example using pre-configured chains -- [example_matrix_custom.json](../cmd/ibctest/example_matrix_custom.json) - More customized example pointing to specific chain binary docker images +- [example_matrix.json](../cmd/interchaintest/example_matrix.json) - Basic example using pre-configured chains +- [example_matrix_custom.json](../cmd/interchaintest/example_matrix_custom.json) - More customized example pointing to specific chain binary docker images By passing in a matrix file you can customize these aspects of the environment: @@ -39,8 +39,8 @@ By passing in a matrix file you can customize these aspects of the environment: **Pre-Configured Chains** -`ibctest` comes with [pre-configured chains](../configuredChains.yaml). -In the matrix file, if `Name` matches the name of any pre-configured chain, `ibctest` will use standard settings UNLESS overriden in the matrix file. [example_matrix_custom.json](../cmd/ibctest/example_matrix_custom.json) is an example of overriding all options. +`interchaintest` comes with [pre-configured chains](../configuredChains.yaml). +In the matrix file, if `Name` matches the name of any pre-configured chain, `interchaintest` will use standard settings UNLESS overriden in the matrix file. [example_matrix_custom.json](../cmd/interchaintest/example_matrix_custom.json) is an example of overriding all options. **Custom Binaries** @@ -57,7 +57,7 @@ If the docker image does not live in a public repository, can you **pass in a lo ], ``` -If you are supplying custom docker images, you will need to fill out ALL values. See [example_matrix_custom.json](../cmd/ibctest/example_matrix_custom.json). +If you are supplying custom docker images, you will need to fill out ALL values. See [example_matrix_custom.json](../cmd/interchaintest/example_matrix_custom.json). Note that the docker images for these pre-configured chains are being pulled from [Heighliner](https://github.com/strangelove-ventures/heighliner) (repository of docker images of many IBC enabled chains). Heighliner needs to have the `Version` you are requesting. @@ -66,7 +66,7 @@ Note that the docker images for these pre-configured chains are being pulled fro **Logs and block history** -Logs, reports and a SQLite3 database files containing block info will be exported out to `~/.ibctest/` +Logs, reports and a SQLite3 database files containing block info will be exported out to `~/.interchaintest/` ## Focusing on Specific Tests @@ -74,27 +74,27 @@ Logs, reports and a SQLite3 database files containing block info will be exporte You may focus on a specific tests using the `-test.run=` flag. ```shell -ibctest -test.run=///// +interchaintest -test.run=///// ``` If you want to focus on a specific test: ```shell -ibctest -test.run=/////relay_packet -ibctest -test.run=/////no_timeout -ibctest -test.run=/////height_timeout -ibctest -test.run=/////timestamp_timeout +interchaintest -test.run=/////relay_packet +interchaintest -test.run=/////no_timeout +interchaintest -test.run=/////height_timeout +interchaintest -test.run=/////timestamp_timeout ``` Example of narrowing your focus even more: ```shell # run all tests for Go relayer -ibctest -test.run=///rly/ +interchaintest -test.run=///rly/ # run all tests for Go relayer and gaia chains -ibctest -test.run=//gaia/rly/ +interchaintest -test.run=//gaia/rly/ # only run no_timeout test for Go relayer and gaia chains -ibctest -test.run=//gaia/rly/conformance/no_timeout +interchaintest -test.run=//gaia/rly/conformance/no_timeout ``` \ No newline at end of file diff --git a/docs/retainingDataOnFailedTests.md b/docs/retainingDataOnFailedTests.md index 24309c795..e6cd16c06 100644 --- a/docs/retainingDataOnFailedTests.md +++ b/docs/retainingDataOnFailedTests.md @@ -10,7 +10,7 @@ Any tests that fail and skip cleanup will log a message like `Not removing temporary directory for test at: /tmp/...`. Test authors must use -[`ibctest.TempDir`](https://pkg.go.dev/github.com/strangelove-ventures/ibctest#TempDir) +[`interchaintest.TempDir`](https://pkg.go.dev/github.com/strangelove-ventures/interchaintest#TempDir) instead of `(*testing.T).Cleanup` to opt in to this behavior. By default, Docker volumes associated with tests are cleaned up at the end of each test run. diff --git a/docs/writeCustomTests.md b/docs/writeCustomTests.md index a4a1e7e78..c4bbb0bca 100644 --- a/docs/writeCustomTests.md +++ b/docs/writeCustomTests.md @@ -9,7 +9,7 @@ This document breaks down code snippets from [learn_ibc_test.go](../examples/ibc It validates each step and confirms that the balances of each wallet are correct. -### Three basic components of `ibctest`: +### Three basic components of `interchaintest`: - **Chain Factory** - Select chain binaries to include in tests - **Relayer Factory** - Select Relayer to use in tests - **Interchain** - Where the testnet is configured and spun up @@ -18,7 +18,7 @@ It validates each step and confirms that the balances of each wallet are correct ## Chain Factory ```go -cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ +cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ GasPrices: "0.0uatom", }}, @@ -28,9 +28,9 @@ cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ The chain factory is where you configure your chain binaries. -`ibctest` needs a docker image with the chain binary(s) installed to spin up the local testnet. +`interchaintest` needs a docker image with the chain binary(s) installed to spin up the local testnet. -`ibctest` has several [pre-configured chains](../configuredChains.yaml). These docker images are pulled from [Heighliner](https://github.com/strangelove-ventures/heighliner) (repository of docker images of many IBC enabled chains). Note that Heighliner needs to have the `Version` you are requesting. +`interchaintest` has several [pre-configured chains](../configuredChains.yaml). These docker images are pulled from [Heighliner](https://github.com/strangelove-ventures/heighliner) (repository of docker images of many IBC enabled chains). Note that Heighliner needs to have the `Version` you are requesting. When creating your `ChainFactory`, if the `Name` matches the name of a pre-configured chain, the pre-configured settings are used. You can override these settings by passing them into the `ibc.ChainConfig` when initializing your ChainFactory. We do this above with `GasPrices` for gaia. @@ -39,7 +39,7 @@ You can also pass in **remote images** and/or **local docker images**. See an examples below: ```go -cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ +cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // -- PRE CONFIGURED CHAIN EXAMPLE -- {Name: "gaia", Version: "v7.0.2"}, @@ -65,10 +65,10 @@ cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ }, }) ``` -If you are not using a pre-configured chain, you must fill out all values of the `ibctest.ChainSpec`. +If you are not using a pre-configured chain, you must fill out all values of the `interchaintest.ChainSpec`. -By default, `ibctest` will spin up a 3 docker images for each chain: +By default, `interchaintest` will spin up a 3 docker images for each chain: - 2 validator nodes - 1 full node. @@ -79,7 +79,7 @@ EXAMPLE: Overriding defaults for number of validators and full nodes in `ChainSp ```go gaiaValidators := int(4) gaiaFullnodes := int(2) -cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ +cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ {Name: "gaia", ChainName: "gaia", Version: "v7.0.2", NumValidators: &gaiaValidators, NumFullNodes: &gaiaFullnodes}, }) ``` @@ -95,12 +95,12 @@ gaia, osmosis := chains[0], chains[1] The relayer factory is where relayer docker images are configured. -Currently only the [Cosmos/Relayer](https://github.com/cosmos/relayer)(CosmosRly) is integrated into `ibctest`. +Currently only the [Cosmos/Relayer](https://github.com/cosmos/relayer)(CosmosRly) is integrated into `interchaintest`. Here we prep an image with the Cosmos/Relayer: ```go -client, network := ibctest.DockerSetup(t) -r := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( +client, network := interchaintest.DockerSetup(t) +r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( t, client, network) ``` @@ -112,11 +112,11 @@ We prep the "interchain" by adding chains, a relayer, and specifying which chain ```go const ibcPath = "gaia-osmosis-demo" -ic := ibctest.NewInterchain(). +ic := interchaintest.NewInterchain(). AddChain(gaia). AddChain(osmosis). AddRelayer(r, "relayer"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia, Chain2: osmosis, Relayer: r, @@ -129,11 +129,11 @@ The `Build` function below spins everything up. ```go rep := testreporter.NewReporter(f) // f is the path to output reports eRep := rep.RelayerExecReporter(t) -require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ +require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: false, })) @@ -150,12 +150,12 @@ Upon calling build, several things happen (specifically for cosmos based chains) - IBC paths are created: `client`, `connection`, `channel` for each link -Note that this function takes a `testReporter`. This will instruct `ibctest` to export and reports of the test(s). The `RelayerExecReporter` satisfies the reporter requirement. +Note that this function takes a `testReporter`. This will instruct `interchaintest` to export and reports of the test(s). The `RelayerExecReporter` satisfies the reporter requirement. Note: If report files are not needed, you can use `testreporter.NewNopReporter()` instead. -Passing in the optional `BlockDatabaseFile` will instruct `ibctest` to create a sqlite3 database with all block history. This includes raw event data. +Passing in the optional `BlockDatabaseFile` will instruct `interchaintest` to create a sqlite3 database with all block history. This includes raw event data. Unless specified, default options are used for `client`, `connection`, and `channel` creation. @@ -171,7 +171,7 @@ Default `createChannelOptions` are: EXAMPLE: Passing in channel options to support the `ics27-1` interchain accounts standard: ```go -require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ +require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -194,11 +194,11 @@ Note the `SkipPathCreation` boolean. You can set this to `true` if IBC paths (`c ## Creating Users(wallets) Here we create new funded wallets(users) for both chains. These wallets are funded from the "faucet" key created at genesis. -Note that there is also the option to restore a wallet (`ibctest.GetAndFundTestUserWithMnemonic`) +Note that there is also the option to restore a wallet (`interchaintest.GetAndFundTestUserWithMnemonic`) ```go fundAmount := int64(10_000_000) -users := ibctest.GetAndFundTestUsers(t, ctx, "default", int64(fundAmount), gaia, osmosis) +users := interchaintest.GetAndFundTestUsers(t, ctx, "default", int64(fundAmount), gaia, osmosis) gaiaUser := users[0] osmosisUser := users[1] ``` @@ -268,7 +268,7 @@ t.log("PRINT STATEMENT: ", variableToPrint) You will need to pass in the `-v` flag in the `go test` command to see this output. Exampled below. -This document only scratches the surface of the full functionality of `ibctest`. Refer to other tests in this repo for more in-depth/advanced testing examples. +This document only scratches the surface of the full functionality of `interchaintest`. Refer to other tests in this repo for more in-depth/advanced testing examples. ## How to run diff --git a/examples/cosmos/chain_upgrade_ibc_test.go b/examples/cosmos/chain_upgrade_ibc_test.go index 3f2621d6c..204c25003 100644 --- a/examples/cosmos/chain_upgrade_ibc_test.go +++ b/examples/cosmos/chain_upgrade_ibc_test.go @@ -5,13 +5,13 @@ import ( "testing" "time" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/conformance" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/conformance" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -27,7 +27,7 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeV t.Parallel() - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: chainName, ChainName: chainName, @@ -46,7 +46,7 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeV chains, err := cf.Chains(t.Name()) require.NoError(t, err) - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) chain, counterpartyChain := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain) @@ -56,7 +56,7 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeV ) // Get a relayer instance - rf := ibctest.NewBuiltinRelayerFactory( + rf := interchaintest.NewBuiltinRelayerFactory( ibc.CosmosRly, zaptest.NewLogger(t), relayer.StartupFlags("-b", "100"), @@ -64,11 +64,11 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeV r := rf.Build(t, client, network) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain). AddChain(counterpartyChain). AddRelayer(r, relayerName). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chain, Chain2: counterpartyChain, Relayer: r, @@ -79,11 +79,11 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeV rep := testreporter.NewNopReporter() - require.NoError(t, ic.Build(ctx, rep.RelayerExecReporter(t), ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, rep.RelayerExecReporter(t), interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: false, })) t.Cleanup(func() { @@ -91,7 +91,7 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeV }) const userFunds = int64(10_000_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain) + users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain) chainUser := users[0] // test IBC conformance before chain upgrade diff --git a/examples/cosmos/chain_upgrade_test.go b/examples/cosmos/chain_upgrade_test.go index 2cfdc25d2..d57fe09a9 100644 --- a/examples/cosmos/chain_upgrade_test.go +++ b/examples/cosmos/chain_upgrade_test.go @@ -8,10 +8,10 @@ import ( "time" "github.com/icza/dyno" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -34,7 +34,7 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeVers t.Parallel() - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: chainName, ChainName: chainName, @@ -50,17 +50,17 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeVers chain := chains[0].(*cosmos.CosmosChain) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain) ctx := context.Background() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - require.NoError(t, ic.Build(ctx, nil, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: true, })) t.Cleanup(func() { @@ -68,7 +68,7 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeVers }) const userFunds = int64(10_000_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain) + users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain) chainUser := users[0] height, err := chain.Height(ctx) diff --git a/examples/cosmos/light_client_test.go b/examples/cosmos/light_client_test.go index 97714653c..feb8ddeaa 100644 --- a/examples/cosmos/light_client_test.go +++ b/examples/cosmos/light_client_test.go @@ -5,10 +5,10 @@ import ( "testing" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -23,7 +23,7 @@ func TestUpdateLightClients(t *testing.T) { ctx := context.Background() // Chains - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ {Name: "gaia", Version: gaiaVersion}, {Name: "osmosis", Version: osmosisVersion}, }) @@ -33,15 +33,15 @@ func TestUpdateLightClients(t *testing.T) { gaia, osmosis := chains[0], chains[1] // Relayer - client, network := ibctest.DockerSetup(t) - r := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( + client, network := interchaintest.DockerSetup(t) + r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( t, client, network) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia). AddChain(osmosis). AddRelayer(r, "relayer"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia, Chain2: osmosis, Relayer: r, @@ -51,7 +51,7 @@ func TestUpdateLightClients(t *testing.T) { // Build interchain rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -67,7 +67,7 @@ func TestUpdateLightClients(t *testing.T) { // Create and Fund User Wallets fundAmount := int64(10_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, "default", fundAmount, gaia, osmosis) + users := interchaintest.GetAndFundTestUsers(t, ctx, "default", fundAmount, gaia, osmosis) gaiaUser, osmoUser := users[0], users[1] // Get Channel ID diff --git a/examples/cosmos/sdk_47_boundary_test.go b/examples/cosmos/sdk_47_boundary_test.go index 034cce1c8..2071b94da 100644 --- a/examples/cosmos/sdk_47_boundary_test.go +++ b/examples/cosmos/sdk_47_boundary_test.go @@ -4,13 +4,13 @@ import ( "context" "testing" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/conformance" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/relayer/rly" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/conformance" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/relayer/rly" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -22,7 +22,7 @@ func TestSDK47Boundary(t *testing.T) { t.Parallel() - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "gaia", ChainName: "gaia", @@ -38,7 +38,7 @@ func TestSDK47Boundary(t *testing.T) { chains, err := cf.Chains(t.Name()) require.NoError(t, err) - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) chain, counterpartyChain := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain) @@ -48,7 +48,7 @@ func TestSDK47Boundary(t *testing.T) { ) // Get a relayer instance - rf := ibctest.NewBuiltinRelayerFactory( + rf := interchaintest.NewBuiltinRelayerFactory( ibc.CosmosRly, zaptest.NewLogger(t), relayer.StartupFlags("-b", "100"), @@ -58,11 +58,11 @@ func TestSDK47Boundary(t *testing.T) { r := rf.Build(t, client, network) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain). AddChain(counterpartyChain). AddRelayer(r, relayerName). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chain, Chain2: counterpartyChain, Relayer: r, @@ -73,11 +73,11 @@ func TestSDK47Boundary(t *testing.T) { rep := testreporter.NewNopReporter() - require.NoError(t, ic.Build(ctx, rep.RelayerExecReporter(t), ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, rep.RelayerExecReporter(t), interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: false, })) t.Cleanup(func() { diff --git a/examples/cosmos/state_sync_test.go b/examples/cosmos/state_sync_test.go index c3571bc7b..c880f3572 100644 --- a/examples/cosmos/state_sync_test.go +++ b/examples/cosmos/state_sync_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -46,7 +46,7 @@ func CosmosChainStateSyncTest(t *testing.T, chainName, version string) { configFileOverrides["config/app.toml"] = appTomlOverrides - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: chainName, ChainName: chainName, @@ -63,17 +63,17 @@ func CosmosChainStateSyncTest(t *testing.T, chainName, version string) { chain := chains[0].(*cosmos.CosmosChain) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain) ctx := context.Background() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - require.NoError(t, ic.Build(ctx, nil, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: true, })) t.Cleanup(func() { diff --git a/examples/ibc/interchain_accounts_test.go b/examples/ibc/interchain_accounts_test.go index 2ea43e1ce..db9b0ab04 100644 --- a/examples/ibc/interchain_accounts_test.go +++ b/examples/ibc/interchain_accounts_test.go @@ -9,12 +9,12 @@ import ( "time" "github.com/cosmos/cosmos-sdk/crypto/keyring" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -28,7 +28,7 @@ func TestInterchainAccounts(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) @@ -36,7 +36,7 @@ func TestInterchainAccounts(t *testing.T) { ctx := context.Background() // Get both chains - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "icad", ChainConfig: ibc.ChainConfig{ @@ -57,7 +57,7 @@ func TestInterchainAccounts(t *testing.T) { chain1, chain2 := chains[0], chains[1] // Get a relayer instance - r := ibctest.NewBuiltinRelayerFactory( + r := interchaintest.NewBuiltinRelayerFactory( ibc.CosmosRly, zaptest.NewLogger(t), relayer.RelayerOptionExtraStartFlags{Flags: []string{"-p", "events", "-b", "100"}}, @@ -67,18 +67,18 @@ func TestInterchainAccounts(t *testing.T) { const pathName = "test-path" const relayerName = "relayer" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain1). AddChain(chain2). AddRelayer(r, relayerName). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chain1, Chain2: chain2, Relayer: r, Path: pathName, }) - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -87,7 +87,7 @@ func TestInterchainAccounts(t *testing.T) { // Fund a user account on chain1 and chain2 const userFunds = int64(10_000_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain1, chain2) + users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain1, chain2) chain1User := users[0] chain2User := users[1] diff --git a/examples/ibc/interchain_queries_test.go b/examples/ibc/interchain_queries_test.go index ca8592f44..d1f159584 100644 --- a/examples/ibc/interchain_queries_test.go +++ b/examples/ibc/interchain_queries_test.go @@ -9,13 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/icza/dyno" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -29,7 +29,7 @@ func TestInterchainQueries(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) @@ -43,7 +43,7 @@ func TestInterchainQueries(t *testing.T) { } // Get both chains - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { ChainName: "sender", ChainConfig: ibc.ChainConfig{ @@ -81,7 +81,7 @@ func TestInterchainQueries(t *testing.T) { chain1, chain2 := chains[0], chains[1] // Get a relayer instance - r := ibctest.NewBuiltinRelayerFactory( + r := interchaintest.NewBuiltinRelayerFactory( ibc.CosmosRly, zaptest.NewLogger(t), relayer.StartupFlags("-b", "100"), @@ -91,11 +91,11 @@ func TestInterchainQueries(t *testing.T) { const pathName = "test1-test2" const relayerName = "relayer" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain1). AddChain(chain2). AddRelayer(r, relayerName). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chain1, Chain2: chain2, Relayer: r, @@ -108,7 +108,7 @@ func TestInterchainQueries(t *testing.T) { }, }) - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -121,7 +121,7 @@ func TestInterchainQueries(t *testing.T) { // Fund user accounts, so we can query balances and make assertions. const userFunds = int64(10_000_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain1, chain2) + users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain1, chain2) chain1User := users[0] chain2User := users[1] diff --git a/examples/ibc/learn_ibc_test.go b/examples/ibc/learn_ibc_test.go index 61a98e0ae..0d92e0ab0 100644 --- a/examples/ibc/learn_ibc_test.go +++ b/examples/ibc/learn_ibc_test.go @@ -7,14 +7,14 @@ import ( "time" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) -// This test is meant to be used as a basic ibctest tutorial. +// This test is meant to be used as a basic interchaintest tutorial. // Code snippets are broken down in ./docs/upAndRunning.md func TestLearn(t *testing.T) { if testing.Short() { @@ -26,7 +26,7 @@ func TestLearn(t *testing.T) { ctx := context.Background() // Chain Factory - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ {Name: "gaia", Version: "v7.0.0", ChainConfig: ibc.ChainConfig{ GasPrices: "0.0uatom", }}, @@ -38,17 +38,17 @@ func TestLearn(t *testing.T) { gaia, osmosis := chains[0], chains[1] // Relayer Factory - client, network := ibctest.DockerSetup(t) - r := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( + client, network := interchaintest.DockerSetup(t) + r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( t, client, network) // Prep Interchain const ibcPath = "gaia-osmo-demo" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia). AddChain(osmosis). AddRelayer(r, "relayer"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia, Chain2: osmosis, Relayer: r, @@ -56,18 +56,18 @@ func TestLearn(t *testing.T) { }) // Log location - f, err := ibctest.CreateLogFile(fmt.Sprintf("%d.json", time.Now().Unix())) + f, err := interchaintest.CreateLogFile(fmt.Sprintf("%d.json", time.Now().Unix())) require.NoError(t, err) // Reporter/logs rep := testreporter.NewReporter(f) eRep := rep.RelayerExecReporter(t) // Build interchain - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: false}, ), @@ -75,7 +75,7 @@ func TestLearn(t *testing.T) { // Create and Fund User Wallets fundAmount := int64(10_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, "default", fundAmount, gaia, osmosis) + users := interchaintest.GetAndFundTestUsers(t, ctx, "default", fundAmount, gaia, osmosis) gaiaUser := users[0] osmosisUser := users[1] diff --git a/examples/ibc/packet_forward_test.go b/examples/ibc/packet_forward_test.go index 1a3b2921e..eb6a92db0 100644 --- a/examples/ibc/packet_forward_test.go +++ b/examples/ibc/packet_forward_test.go @@ -7,13 +7,13 @@ import ( "time" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/relayer/rly" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/relayer/rly" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -37,7 +37,7 @@ func TestPacketForwardMiddleware(t *testing.T) { t.Skip("skipping in short mode") } - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) @@ -46,11 +46,11 @@ func TestPacketForwardMiddleware(t *testing.T) { chainID_A, chainID_B, chainID_C, chainID_D := "chain-a", "chain-b", "chain-c", "chain-d" - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ - {Name: "gaia", Version: "strangelove-forward_middleware_memo_v3", ChainConfig: ibc.ChainConfig{ChainID: chainID_A, GasPrices: "0.0uatom"}}, - {Name: "gaia", Version: "strangelove-forward_middleware_memo_v3", ChainConfig: ibc.ChainConfig{ChainID: chainID_B, GasPrices: "0.0uatom"}}, - {Name: "gaia", Version: "strangelove-forward_middleware_memo_v3", ChainConfig: ibc.ChainConfig{ChainID: chainID_C, GasPrices: "0.0uatom"}}, - {Name: "gaia", Version: "strangelove-forward_middleware_memo_v3", ChainConfig: ibc.ChainConfig{ChainID: chainID_D, GasPrices: "0.0uatom"}}, + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ + {Name: "gaia", Version: "v8.0.0-rc3", ChainConfig: ibc.ChainConfig{ChainID: chainID_A, GasPrices: "0.0uatom"}}, + {Name: "gaia", Version: "v8.0.0-rc3", ChainConfig: ibc.ChainConfig{ChainID: chainID_B, GasPrices: "0.0uatom"}}, + {Name: "gaia", Version: "v8.0.0-rc3", ChainConfig: ibc.ChainConfig{ChainID: chainID_C, GasPrices: "0.0uatom"}}, + {Name: "gaia", Version: "v8.0.0-rc3", ChainConfig: ibc.ChainConfig{ChainID: chainID_D, GasPrices: "0.0uatom"}}, }) chains, err := cf.Chains(t.Name()) @@ -58,7 +58,7 @@ func TestPacketForwardMiddleware(t *testing.T) { chainA, chainB, chainC, chainD := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain), chains[2].(*cosmos.CosmosChain), chains[3].(*cosmos.CosmosChain) - r := ibctest.NewBuiltinRelayerFactory( + r := interchaintest.NewBuiltinRelayerFactory( ibc.CosmosRly, zaptest.NewLogger(t), // TODO remove this line once default rly version includes https://github.com/cosmos/relayer/pull/1038 @@ -69,36 +69,36 @@ func TestPacketForwardMiddleware(t *testing.T) { const pathBC = "bc" const pathCD = "cd" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chainA). AddChain(chainB). AddChain(chainC). AddChain(chainD). AddRelayer(r, "relayer"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chainA, Chain2: chainB, Relayer: r, Path: pathAB, }). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chainB, Chain2: chainC, Relayer: r, Path: pathBC, }). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: chainC, Chain2: chainD, Relayer: r, Path: pathCD, }) - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: false, })) @@ -107,7 +107,7 @@ func TestPacketForwardMiddleware(t *testing.T) { }) const userFunds = int64(10_000_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chainA, chainB, chainC, chainD) + users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chainA, chainB, chainC, chainD) abChan, err := ibc.GetTransferChannel(ctx, r, eRep, chainID_A, chainID_B) require.NoError(t, err) @@ -616,4 +616,50 @@ func TestPacketForwardMiddleware(t *testing.T) { require.Equal(t, int64(0), bcEscrowBalance) require.Equal(t, int64(0), cdEscrowBalance) }) + + t.Run("forward a->b->a", func(t *testing.T) { + // Send packet from Chain A->Chain B->Chain A + + userABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom) + require.NoError(t, err, "failed to get user a balance") + + userBBalance, err := chainB.GetBalance(ctx, userB.FormattedAddress(), firstHopDenom) + require.NoError(t, err, "failed to get user a balance") + + transfer := ibc.WalletAmount{ + Address: userB.FormattedAddress(), + Denom: chainA.Config().Denom, + Amount: transferAmount, + } + + firstHopMetadata := &PacketMetadata{ + Forward: &ForwardMetadata{ + Receiver: userA.FormattedAddress(), + Channel: baChan.ChannelID, + Port: baChan.PortID, + }, + } + + memo, err := json.Marshal(firstHopMetadata) + require.NoError(t, err) + + chainAHeight, err := chainA.Height(ctx) + require.NoError(t, err) + + transferTx, err := chainA.SendIBCTransfer(ctx, abChan.ChannelID, userA.KeyName(), transfer, ibc.TransferOptions{Memo: string(memo)}) + require.NoError(t, err) + _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) + require.NoError(t, err) + err = testutil.WaitForBlocks(ctx, 1, chainA) + require.NoError(t, err) + + chainABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom) + require.NoError(t, err) + + chainBBalance, err := chainB.GetBalance(ctx, userB.FormattedAddress(), firstHopIBCDenom) + require.NoError(t, err) + + require.Equal(t, userABalance, chainABalance) + require.Equal(t, userBBalance, chainBBalance) + }) } diff --git a/examples/penumbra/penumbra_chain_test.go b/examples/penumbra/penumbra_chain_test.go index ea995d97e..f646095c7 100644 --- a/examples/penumbra/penumbra_chain_test.go +++ b/examples/penumbra/penumbra_chain_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -17,14 +17,14 @@ func TestPenumbraChainStart(t *testing.T) { } t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) nv := 4 - chains, err := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + chains, err := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "penumbra", - Version: "033-eirene,v0.34.21", + Version: "040-themisto.1,v0.34.21", ChainConfig: ibc.ChainConfig{ ChainID: "penumbra-1", }, diff --git a/examples/polkadot/polkadot_chain_test.go b/examples/polkadot/polkadot_chain_test.go index 45ca1af00..2670ed2f4 100644 --- a/examples/polkadot/polkadot_chain_test.go +++ b/examples/polkadot/polkadot_chain_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/polkadot" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/polkadot" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -21,7 +21,7 @@ func TestPolkadotComposableChainStart(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) @@ -31,7 +31,7 @@ func TestPolkadotComposableChainStart(t *testing.T) { nv := 5 nf := 3 - chains, err := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + chains, err := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { ChainConfig: ibc.ChainConfig{ Type: "polkadot", @@ -67,10 +67,10 @@ func TestPolkadotComposableChainStart(t *testing.T) { require.Len(t, chains, 1) chain := chains[0] - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(chain) - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -150,13 +150,13 @@ func TestPolkadotComposableChainStart(t *testing.T) { // Fund user1 on both relay and parachain, must wait a block to fund user2 due to same faucet address fundAmount := int64(12_333_000_000_000) - users1 := ibctest.GetAndFundTestUsers(t, ctx, "user1", fundAmount, polkadotChain) + users1 := interchaintest.GetAndFundTestUsers(t, ctx, "user1", fundAmount, polkadotChain) user1 := users1[0] err = testutil.WaitForBlocks(ctx, 2, chain) require.NoError(t, err, "polkadot chain failed to make blocks") // Fund user2 on both relay and parachain, check that user1 was funded properly - users2 := ibctest.GetAndFundTestUsers(t, ctx, "user2", fundAmount, polkadotChain) + users2 := interchaintest.GetAndFundTestUsers(t, ctx, "user2", fundAmount, polkadotChain) user2 := users2[0] polkadotUser1Amount, err := polkadotChain.GetBalance(ctx, user1.FormattedAddress(), polkadotChain.Config().Denom) require.NoError(t, err) diff --git a/examples/polkadot/push_wasm_client_code_test.go b/examples/polkadot/push_wasm_client_code_test.go index ce0866534..8ce830174 100644 --- a/examples/polkadot/push_wasm_client_code_test.go +++ b/examples/polkadot/push_wasm_client_code_test.go @@ -6,11 +6,11 @@ import ( "encoding/hex" "testing" - "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" //simappparams "github.com/cosmos/cosmos-sdk/simapp/params" @@ -33,7 +33,7 @@ func TestPushWasmClientCode(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) @@ -62,7 +62,7 @@ func TestPushWasmClientCode(t *testing.T) { configFileOverrides["config/app.toml"] = appTomlOverrides configFileOverrides["config/config.toml"] = configTomlOverrides - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ /*{ Name: "ibc-go-simd", Version: "feat/wasm-client", @@ -102,15 +102,15 @@ func TestPushWasmClientCode(t *testing.T) { simd := chains[0] t.Logf("NewInterchain") - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(simd) t.Logf("Interchain build options") - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - BlockDatabaseFile: ibctest.DefaultBlockDatabaseFilepath(), + BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(), SkipPathCreation: true, // Skip path creation, so we can have granular control over the process })) @@ -120,7 +120,7 @@ func TestPushWasmClientCode(t *testing.T) { // Create and Fund User Wallets fundAmount := int64(100_000_000) - users := ibctest.GetAndFundTestUsers(t, ctx, "default", int64(fundAmount), simd) + users := interchaintest.GetAndFundTestUsers(t, ctx, "default", int64(fundAmount), simd) simd1User := users[0] err = testutil.WaitForBlocks(ctx, 2, simd) diff --git a/examples/polkadot/substrate_cosmos_ibc_test.go b/examples/polkadot/substrate_cosmos_ibc_test.go index 2a0343b80..e9614b59b 100644 --- a/examples/polkadot/substrate_cosmos_ibc_test.go +++ b/examples/polkadot/substrate_cosmos_ibc_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" - "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -25,7 +25,7 @@ func TestSubstrateToCosmosIBC(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) @@ -36,7 +36,7 @@ func TestSubstrateToCosmosIBC(t *testing.T) { nf := 3 // Number of full nodes // Get both chains - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { //Name: "composable", //Version: "seunlanlege/centauri-polkadot:v0.9.27,seunlanlege/centauri-parachain:v0.9.27", @@ -101,7 +101,7 @@ func TestSubstrateToCosmosIBC(t *testing.T) { composable, simd := chains[0], chains[1] // Get a relayer instance - r := ibctest.NewBuiltinRelayerFactory( + r := interchaintest.NewBuiltinRelayerFactory( ibc.CosmosRly, zaptest.NewLogger(t), relayer.StartupFlags("-b", "100"), @@ -115,18 +115,18 @@ func TestSubstrateToCosmosIBC(t *testing.T) { const pathName = "composable-simd" const relayerName = "relayer" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(composable). AddChain(simd) //. //AddRelayer(r, relayerName). - /*AddLink(ibctest.InterchainLink{ + /*AddLink(interchaintest.InterchainLink{ Chain1: composable, Chain2: simd, Relayer: r, Path: pathName, })*/ - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, diff --git a/go.mod b/go.mod index 39f7df092..3dfc8ec36 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/strangelove-ventures/ibctest/v7 +module github.com/strangelove-ventures/interchaintest/v7 go 1.19 diff --git a/ibc/chain.go b/ibc/chain.go index 994c55113..577e3801b 100644 --- a/ibc/chain.go +++ b/ibc/chain.go @@ -4,7 +4,7 @@ import ( "context" "github.com/docker/docker/client" - //"github.com/strangelove-ventures/ibctest/v7/ibc" + //"github.com/strangelove-ventures/interchaintest/v7/ibc" ) type Chain interface { diff --git a/ibc/relayer.go b/ibc/relayer.go index 03e9705f9..097206688 100644 --- a/ibc/relayer.go +++ b/ibc/relayer.go @@ -85,7 +85,7 @@ type Relayer interface { // // If false, the relayer will connect to the localhost-exposed ports instead of the docker hosts. // - // Relayer implementations provided by the ibctest module will report true, + // Relayer implementations provided by the interchaintest module will report true, // but custom implementations may report false. UseDockerNetwork() bool diff --git a/ibc/types.go b/ibc/types.go index 0f6f4c2e8..741b13e96 100644 --- a/ibc/types.go +++ b/ibc/types.go @@ -8,7 +8,7 @@ import ( ibcexported "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" ) -// ChainConfig defines the chain parameters requires to run an ibctest testnet for a chain. +// ChainConfig defines the chain parameters requires to run an interchaintest testnet for a chain. type ChainConfig struct { // Chain type, e.g. cosmos. Type string `yaml:"type"` diff --git a/interchain.go b/interchain.go index 1e54eb2c0..83111d170 100644 --- a/interchain.go +++ b/interchain.go @@ -1,12 +1,12 @@ -package ibctest +package interchaintest import ( "context" "fmt" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "go.uber.org/zap" "golang.org/x/sync/errgroup" ) diff --git a/interchain_test.go b/interchain_test.go index ef89e64f7..17f476ddd 100644 --- a/interchain_test.go +++ b/interchain_test.go @@ -1,4 +1,4 @@ -package ibctest_test +package interchaintest_test import ( "context" @@ -11,12 +11,12 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/chain/cosmos" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer/rly" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer/rly" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap" "go.uber.org/zap/zaptest" @@ -32,9 +32,9 @@ func TestInterchain_DuplicateChain(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. {Name: "gaia", ChainName: "g1", Version: "v7.0.1"}, {Name: "gaia", ChainName: "g2", Version: "v7.0.1"}, @@ -45,15 +45,15 @@ func TestInterchain_DuplicateChain(t *testing.T) { gaia0, gaia1 := chains[0], chains[1] - r := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( + r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( t, client, network, ) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia0). AddChain(gaia1). AddRelayer(r, "r"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia0, Chain2: gaia1, Relayer: r, @@ -63,7 +63,7 @@ func TestInterchain_DuplicateChain(t *testing.T) { eRep := rep.RelayerExecReporter(t) ctx := context.Background() - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -80,9 +80,9 @@ func TestInterchain_GetRelayerWallets(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}}, @@ -93,15 +93,15 @@ func TestInterchain_GetRelayerWallets(t *testing.T) { gaia0, gaia1 := chains[0], chains[1] - r := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( + r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( t, client, network, ) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia0). AddChain(gaia1). AddRelayer(r, "r"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia0, Chain2: gaia1, Relayer: r, @@ -111,7 +111,7 @@ func TestInterchain_GetRelayerWallets(t *testing.T) { eRep := rep.RelayerExecReporter(t) ctx := context.Background() - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -159,9 +159,9 @@ func TestInterchain_CreateUser(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, }) @@ -171,14 +171,14 @@ func TestInterchain_CreateUser(t *testing.T) { gaia0 := chains[0] - ic := ibctest.NewInterchain().AddChain(gaia0) + ic := interchaintest.NewInterchain().AddChain(gaia0) defer ic.Close() rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) ctx := context.Background() - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -203,7 +203,7 @@ func TestInterchain_CreateUser(t *testing.T) { require.NoError(t, err) require.NotEmpty(t, mnemonic) - user, err := ibctest.GetAndFundTestUserWithMnemonic(ctx, keyName, mnemonic, 10000, gaia0) + user, err := interchaintest.GetAndFundTestUserWithMnemonic(ctx, keyName, mnemonic, 10000, gaia0) require.NoError(t, err) require.NoError(t, testutil.WaitForBlocks(ctx, 2, gaia0)) require.NotEmpty(t, user.Address()) @@ -217,7 +217,7 @@ func TestInterchain_CreateUser(t *testing.T) { t.Run("without mnemonic", func(t *testing.T) { keyName := "regular-user-name" - users := ibctest.GetAndFundTestUsers(t, ctx, keyName, 10000, gaia0) + users := interchaintest.GetAndFundTestUsers(t, ctx, keyName, 10000, gaia0) require.NoError(t, testutil.WaitForBlocks(ctx, 2, gaia0)) require.Len(t, users, 1) require.NotEmpty(t, users[0].Address()) @@ -236,9 +236,9 @@ func TestCosmosChain_BroadcastTx(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}}, @@ -249,16 +249,16 @@ func TestCosmosChain_BroadcastTx(t *testing.T) { gaia0, gaia1 := chains[0], chains[1] - r := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( + r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)).Build( t, client, network, ) pathName := "p" - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia0). AddChain(gaia1). AddRelayer(r, "r"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia0, Chain2: gaia1, Relayer: r, @@ -269,13 +269,13 @@ func TestCosmosChain_BroadcastTx(t *testing.T) { eRep := rep.RelayerExecReporter(t) ctx := context.Background() - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, })) - testUser := ibctest.GetAndFundTestUsers(t, ctx, "gaia-user-1", 10_000_000, gaia0)[0] + testUser := interchaintest.GetAndFundTestUsers(t, ctx, "gaia-user-1", 10_000_000, gaia0)[0] sendAmount := int64(10000) @@ -315,7 +315,7 @@ func TestCosmosChain_BroadcastTx(t *testing.T) { }) } -// An external package that imports ibctest may not provide a GitSha when they provide a BlockDatabaseFile. +// An external package that imports interchaintest may not provide a GitSha when they provide a BlockDatabaseFile. // The GitSha field is documented as optional, so this should succeed. func TestInterchain_OmitGitSHA(t *testing.T) { if testing.Short() { @@ -324,9 +324,9 @@ func TestInterchain_OmitGitSHA(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ {Name: "gaia", Version: "v7.0.1"}, }) @@ -334,13 +334,13 @@ func TestInterchain_OmitGitSHA(t *testing.T) { require.NoError(t, err) gaia := chains[0] - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia) rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) ctx := context.Background() - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -354,7 +354,7 @@ func TestInterchain_OmitGitSHA(t *testing.T) { func TestInterchain_ConflictRejection(t *testing.T) { t.Run("duplicate chain", func(t *testing.T) { - cf := ibctest.NewBuiltinChainFactory(zap.NewNop(), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zap.NewNop(), []*interchaintest.ChainSpec{ {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, }) @@ -364,12 +364,12 @@ func TestInterchain_ConflictRejection(t *testing.T) { exp := fmt.Sprintf("chain %v was already added", chain) require.PanicsWithError(t, exp, func() { - _ = ibctest.NewInterchain().AddChain(chain).AddChain(chain) + _ = interchaintest.NewInterchain().AddChain(chain).AddChain(chain) }) }) t.Run("chain name", func(t *testing.T) { - cf := ibctest.NewBuiltinChainFactory(zap.NewNop(), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zap.NewNop(), []*interchaintest.ChainSpec{ // Different ChainID, but explicit ChainName used twice. {Name: "gaia", ChainName: "g", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, {Name: "gaia", ChainName: "g", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}}, @@ -379,12 +379,12 @@ func TestInterchain_ConflictRejection(t *testing.T) { require.NoError(t, err) require.PanicsWithError(t, "a chain with name g already exists", func() { - _ = ibctest.NewInterchain().AddChain(chains[0]).AddChain(chains[1]) + _ = interchaintest.NewInterchain().AddChain(chains[0]).AddChain(chains[1]) }) }) t.Run("chain ID", func(t *testing.T) { - cf := ibctest.NewBuiltinChainFactory(zap.NewNop(), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zap.NewNop(), []*interchaintest.ChainSpec{ // Valid ChainName but duplicate ChainID. {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, @@ -394,7 +394,7 @@ func TestInterchain_ConflictRejection(t *testing.T) { require.NoError(t, err) require.PanicsWithError(t, "a chain with ID cosmoshub-0 already exists", func() { - _ = ibctest.NewInterchain().AddChain(chains[0]).AddChain(chains[1]) + _ = interchaintest.NewInterchain().AddChain(chains[0]).AddChain(chains[1]) }) }) @@ -403,7 +403,7 @@ func TestInterchain_ConflictRejection(t *testing.T) { exp := fmt.Sprintf("relayer %v was already added", &r) require.PanicsWithError(t, exp, func() { - _ = ibctest.NewInterchain().AddRelayer(&r, "r1").AddRelayer(&r, "r2") + _ = interchaintest.NewInterchain().AddRelayer(&r, "r1").AddRelayer(&r, "r2") }) }) @@ -411,18 +411,18 @@ func TestInterchain_ConflictRejection(t *testing.T) { var r1, r2 rly.CosmosRelayer require.PanicsWithError(t, "a relayer with name r already exists", func() { - _ = ibctest.NewInterchain().AddRelayer(&r1, "r").AddRelayer(&r2, "r") + _ = interchaintest.NewInterchain().AddRelayer(&r1, "r").AddRelayer(&r2, "r") }) }) } func TestInterchain_AddNil(t *testing.T) { require.PanicsWithError(t, "cannot add nil chain", func() { - _ = ibctest.NewInterchain().AddChain(nil) + _ = interchaintest.NewInterchain().AddChain(nil) }) require.PanicsWithError(t, "cannot add nil relayer", func() { - _ = ibctest.NewInterchain().AddRelayer(nil, "r") + _ = interchaintest.NewInterchain().AddRelayer(nil, "r") }) } diff --git a/ibctest.go b/interchaintest.go similarity index 71% rename from ibctest.go rename to interchaintest.go index 3672717b4..6d999afbe 100644 --- a/ibctest.go +++ b/interchaintest.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "fmt" @@ -6,13 +6,13 @@ import ( "path/filepath" ) -// CreateLogFile creates a file with name in dir $HOME/.ibctest/logs/ +// CreateLogFile creates a file with name in dir $HOME/.interchaintest/logs/ func CreateLogFile(name string) (*os.File, error) { home, err := os.UserHomeDir() if err != nil { return nil, fmt.Errorf("user home dir: %w", err) } - fpath := filepath.Join(home, ".ibctest", "logs") + fpath := filepath.Join(home, ".interchaintest", "logs") err = os.MkdirAll(fpath, 0755) if err != nil { return nil, fmt.Errorf("mkdirall: %w", err) @@ -26,5 +26,5 @@ func DefaultBlockDatabaseFilepath() string { if err != nil { panic(err) } - return filepath.Join(home, ".ibctest", "databases", "block.db") + return filepath.Join(home, ".interchaintest", "databases", "block.db") } diff --git a/ibctest_test.go b/interchaintest_test.go similarity index 68% rename from ibctest_test.go rename to interchaintest_test.go index f09d3da23..fa8542afa 100644 --- a/ibctest_test.go +++ b/interchaintest_test.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "os" @@ -13,5 +13,5 @@ func TestDefaultBlockDatabaseFilepath(t *testing.T) { parts := strings.Split(got, string(os.PathSeparator)) require.NotEmpty(t, parts) - require.Equal(t, []string{".ibctest", "databases", "block.db"}, parts[len(parts)-3:]) + require.Equal(t, []string{".interchaintest", "databases", "block.db"}, parts[len(parts)-3:]) } diff --git a/internal/blockdb/doc.go b/internal/blockdb/doc.go index e9003c5cb..190e3881d 100644 --- a/internal/blockdb/doc.go +++ b/internal/blockdb/doc.go @@ -1,2 +1,2 @@ -// Package blockdb saves chain and block data for inspection later to aid in debugging ibctest failures. +// Package blockdb saves chain and block data for inspection later to aid in debugging interchaintest failures. package blockdb diff --git a/internal/blockdb/messages_view_test.go b/internal/blockdb/messages_view_test.go index 74a46104d..6a7ed4d00 100644 --- a/internal/blockdb/messages_view_test.go +++ b/internal/blockdb/messages_view_test.go @@ -1,7 +1,7 @@ package blockdb_test // This test is in a separate file, so it can be in the blockdb_test package, -// so it can import ibctest without creating an import cycle. +// so it can import interchaintest without creating an import cycle. import ( "context" @@ -10,11 +10,11 @@ import ( "testing" "github.com/cosmos/cosmos-sdk/types" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/testreporter" - "github.com/strangelove-ventures/ibctest/v7/testutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -26,11 +26,11 @@ func TestMessagesView(t *testing.T) { t.Parallel() - client, network := ibctest.DockerSetup(t) + client, network := interchaintest.DockerSetup(t) const gaia0ChainID = "g0" const gaia1ChainID = "g1" - cf := ibctest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*ibctest.ChainSpec{ + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: gaia0ChainID}}, {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: gaia1ChainID}}, }) @@ -40,27 +40,27 @@ func TestMessagesView(t *testing.T) { gaia0, gaia1 := chains[0], chains[1] - rf := ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)) + rf := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)) r := rf.Build(t, client, network) - ic := ibctest.NewInterchain(). + ic := interchaintest.NewInterchain(). AddChain(gaia0). AddChain(gaia1). AddRelayer(r, "r"). - AddLink(ibctest.InterchainLink{ + AddLink(interchaintest.InterchainLink{ Chain1: gaia0, Chain2: gaia1, Relayer: r, }) - dbDir := ibctest.TempDir(t) + dbDir := interchaintest.TempDir(t) dbPath := filepath.Join(dbDir, "blocks.db") rep := testreporter.NewNopReporter() eRep := rep.RelayerExecReporter(t) ctx := context.Background() - require.NoError(t, ic.Build(ctx, eRep, ibctest.InterchainBuildOptions{ + require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -248,7 +248,7 @@ WHERE type = "/ibc.core.channel.v1.MsgChannelOpenConfirm" AND chain_id = ? t.Run("initiate transfer", func(t *testing.T) { // Build the faucet address for gaia1, so that gaia0 can send it a transfer. - g1FaucetAddrBytes, err := gaia1.GetAddress(ctx, ibctest.FaucetAccountKeyName) + g1FaucetAddrBytes, err := gaia1.GetAddress(ctx, interchaintest.FaucetAccountKeyName) require.NoError(t, err) gaia1FaucetAddr, err := types.Bech32ifyAddressBytes(gaia1.Config().Bech32Prefix, g1FaucetAddrBytes) require.NoError(t, err) @@ -260,7 +260,7 @@ WHERE type = "/ibc.core.channel.v1.MsgChannelOpenConfirm" AND chain_id = ? Denom: gaia0.Config().Denom, Amount: txAmount, } - tx, err := gaia0.SendIBCTransfer(ctx, gaia0ChannelID, ibctest.FaucetAccountKeyName, transfer, ibc.TransferOptions{}) + tx, err := gaia0.SendIBCTransfer(ctx, gaia0ChannelID, interchaintest.FaucetAccountKeyName, transfer, ibc.TransferOptions{}) require.NoError(t, err) require.NoError(t, tx.Validate()) diff --git a/internal/blockdb/testdata/README.md b/internal/blockdb/testdata/README.md index 6654a52c3..5c97bd455 100644 --- a/internal/blockdb/testdata/README.md +++ b/internal/blockdb/testdata/README.md @@ -5,5 +5,5 @@ For sample_txs.json Produces an array of JSON objects: ```shell -sqlite3 ~/.ibctest/databases/block.db 'select tx_id, tx from v_tx_flattened where chain_kid = 1 order by tx_id asc' -json > /some/file/path.json +sqlite3 ~/.interchaintest/databases/block.db 'select tx_id, tx from v_tx_flattened where chain_kid = 1 order by tx_id asc' -json > /some/file/path.json ``` \ No newline at end of file diff --git a/internal/blockdb/tui/model.go b/internal/blockdb/tui/model.go index ebb8ca4ab..169297237 100644 --- a/internal/blockdb/tui/model.go +++ b/internal/blockdb/tui/model.go @@ -6,7 +6,7 @@ import ( "github.com/atotto/clipboard" "github.com/rivo/tview" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" ) //go:generate go run golang.org/x/tools/cmd/stringer -type=mainContent diff --git a/internal/blockdb/tui/model_test.go b/internal/blockdb/tui/model_test.go index 0767939d9..0cdce5cb7 100644 --- a/internal/blockdb/tui/model_test.go +++ b/internal/blockdb/tui/model_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" "github.com/stretchr/testify/require" ) diff --git a/internal/blockdb/tui/presenter/cosmos_message.go b/internal/blockdb/tui/presenter/cosmos_message.go index 9c2d6579d..ad7795d5f 100644 --- a/internal/blockdb/tui/presenter/cosmos_message.go +++ b/internal/blockdb/tui/presenter/cosmos_message.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" ) // CosmosMessage presents a blockdb.CosmosMessageResult. diff --git a/internal/blockdb/tui/presenter/cosmos_message_test.go b/internal/blockdb/tui/presenter/cosmos_message_test.go index d1cf4177a..67a29f9ec 100644 --- a/internal/blockdb/tui/presenter/cosmos_message_test.go +++ b/internal/blockdb/tui/presenter/cosmos_message_test.go @@ -4,7 +4,7 @@ import ( "database/sql" "testing" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" "github.com/stretchr/testify/require" ) diff --git a/internal/blockdb/tui/presenter/test_case.go b/internal/blockdb/tui/presenter/test_case.go index bcef8de42..1dd3334a4 100644 --- a/internal/blockdb/tui/presenter/test_case.go +++ b/internal/blockdb/tui/presenter/test_case.go @@ -3,7 +3,7 @@ package presenter import ( "strconv" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" ) // TestCase presents a blockdb.TestCaseResult. diff --git a/internal/blockdb/tui/presenter/test_case_test.go b/internal/blockdb/tui/presenter/test_case_test.go index 5389ca937..82af43cda 100644 --- a/internal/blockdb/tui/presenter/test_case_test.go +++ b/internal/blockdb/tui/presenter/test_case_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" "github.com/stretchr/testify/require" ) diff --git a/internal/blockdb/tui/presenter/tx.go b/internal/blockdb/tui/presenter/tx.go index 5b7b4925f..dc9219cd0 100644 --- a/internal/blockdb/tui/presenter/tx.go +++ b/internal/blockdb/tui/presenter/tx.go @@ -6,7 +6,7 @@ import ( "strconv" "sync" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" ) var bufPool = sync.Pool{New: func() any { return new(bytes.Buffer) }} diff --git a/internal/blockdb/tui/presenter/tx_test.go b/internal/blockdb/tui/presenter/tx_test.go index a91fc8587..3bceb3eef 100644 --- a/internal/blockdb/tui/presenter/tx_test.go +++ b/internal/blockdb/tui/presenter/tx_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" "github.com/stretchr/testify/require" ) diff --git a/internal/blockdb/tui/update.go b/internal/blockdb/tui/update.go index 10f452aa4..a6acbd253 100644 --- a/internal/blockdb/tui/update.go +++ b/internal/blockdb/tui/update.go @@ -7,7 +7,7 @@ import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb/tui/presenter" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb/tui/presenter" ) // Update should be the argument for *(tview.Application).SetInputCapture. diff --git a/internal/blockdb/tui/update_test.go b/internal/blockdb/tui/update_test.go index 352d2d40f..89a7afb4b 100644 --- a/internal/blockdb/tui/update_test.go +++ b/internal/blockdb/tui/update_test.go @@ -9,7 +9,7 @@ import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" "github.com/stretchr/testify/require" ) diff --git a/internal/blockdb/tui/views.go b/internal/blockdb/tui/views.go index 50470725f..7c02f70c6 100644 --- a/internal/blockdb/tui/views.go +++ b/internal/blockdb/tui/views.go @@ -8,8 +8,8 @@ import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb" - "github.com/strangelove-ventures/ibctest/v7/internal/blockdb/tui/presenter" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb" + "github.com/strangelove-ventures/interchaintest/v7/internal/blockdb/tui/presenter" ) func headerView(m *Model) *tview.Flex { diff --git a/internal/dockerutil/fileretriever.go b/internal/dockerutil/fileretriever.go index e9cec4e68..3e4725fb8 100644 --- a/internal/dockerutil/fileretriever.go +++ b/internal/dockerutil/fileretriever.go @@ -38,7 +38,7 @@ func (r *FileRetriever) SingleFileContent(ctx context.Context, volumeName, relPa return nil, err } - containerName := fmt.Sprintf("ibctest-getfile-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) + containerName := fmt.Sprintf("interchaintest-getfile-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) cc, err := r.cli.ContainerCreate( ctx, diff --git a/internal/dockerutil/fileretriever_test.go b/internal/dockerutil/fileretriever_test.go index 886cf4231..1225b98ae 100644 --- a/internal/dockerutil/fileretriever_test.go +++ b/internal/dockerutil/fileretriever_test.go @@ -5,8 +5,8 @@ import ( "testing" volumetypes "github.com/docker/docker/api/types/volume" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -18,7 +18,7 @@ func TestFileRetriever(t *testing.T) { t.Parallel() - cli, network := ibctest.DockerSetup(t) + cli, network := interchaintest.DockerSetup(t) ctx := context.Background() v, err := cli.VolumeCreate(ctx, volumetypes.VolumeCreateBody{ diff --git a/internal/dockerutil/filewriter.go b/internal/dockerutil/filewriter.go index 11e6ea3bd..44bde3f4b 100644 --- a/internal/dockerutil/filewriter.go +++ b/internal/dockerutil/filewriter.go @@ -37,7 +37,7 @@ func (w *FileWriter) WriteFile(ctx context.Context, volumeName, relPath string, return err } - containerName := fmt.Sprintf("ibctest-writefile-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) + containerName := fmt.Sprintf("interchaintest-writefile-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) cc, err := w.cli.ContainerCreate( ctx, diff --git a/internal/dockerutil/filewriter_test.go b/internal/dockerutil/filewriter_test.go index 161448a0a..1898b8784 100644 --- a/internal/dockerutil/filewriter_test.go +++ b/internal/dockerutil/filewriter_test.go @@ -5,8 +5,8 @@ import ( "testing" volumetypes "github.com/docker/docker/api/types/volume" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -18,7 +18,7 @@ func TestFileWriter(t *testing.T) { t.Parallel() - cli, network := ibctest.DockerSetup(t) + cli, network := interchaintest.DockerSetup(t) ctx := context.Background() v, err := cli.VolumeCreate(ctx, volumetypes.VolumeCreateBody{ diff --git a/internal/dockerutil/setup.go b/internal/dockerutil/setup.go index a0deba816..e4b02227b 100644 --- a/internal/dockerutil/setup.go +++ b/internal/dockerutil/setup.go @@ -30,7 +30,7 @@ type DockerSetupTestingT interface { // CleanupLabel is a docker label key targeted by DockerSetup when it cleans up docker resources. // -// "ibctest" is perhaps a better name. However, for backwards compatability we preserve the original name of "ibc-test" +// "interchaintest" is perhaps a better name. However, for backwards compatability we preserve the original name of "ibc-test" // with the hyphen. Otherwise, we run the risk of causing "container already exists" errors because DockerSetup // is unable to clean old resources from docker engine. const CleanupLabel = "ibc-test" @@ -40,8 +40,8 @@ const CleanupLabel = "ibc-test" // https://docs.docker.com/config/labels-custom-metadata/#key-format-recommendations. const ( - // LabelPrefix is the reverse DNS format "namespace" for ibctest Docker labels. - LabelPrefix = "ventures.strangelove.ibctest." + // LabelPrefix is the reverse DNS format "namespace" for interchaintest Docker labels. + LabelPrefix = "ventures.strangelove.interchaintest." // NodeOwnerLabel indicates the logical node owning a particular object (probably a volume). NodeOwnerLabel = LabelPrefix + "node-owner" @@ -54,7 +54,7 @@ const ( // environment variable IBCTEST_SKIP_FAILURE_CLEANUP to a non-empty value. // Alternatively, importers of the dockerutil package may set the variable to true. // Because dockerutil is an internal package, the public API for setting this value -// is ibctest.KeepDockerVolumesOnFailure(bool). +// is interchaintest.KeepDockerVolumesOnFailure(bool). var KeepVolumesOnFailure = os.Getenv("IBCTEST_SKIP_FAILURE_CLEANUP") != "" // DockerSetup returns a new Docker Client and the ID of a configured network, associated with t. @@ -75,7 +75,7 @@ func DockerSetup(t DockerSetupTestingT) (*client.Client, string) { // e.g. if the test was interrupted. dockerCleanup(t, cli)() - name := fmt.Sprintf("ibctest-%s", RandLowerCaseLetterString(8)) + name := fmt.Sprintf("interchaintest-%s", RandLowerCaseLetterString(8)) network, err := cli.NetworkCreate(context.TODO(), name, types.NetworkCreate{ CheckDuplicate: true, diff --git a/internal/dockerutil/setup_test.go b/internal/dockerutil/setup_test.go index d79106cf8..d5b4494e4 100644 --- a/internal/dockerutil/setup_test.go +++ b/internal/dockerutil/setup_test.go @@ -7,8 +7,8 @@ import ( volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/errdefs" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/internal/mocktesting" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/internal/mocktesting" "github.com/stretchr/testify/require" ) diff --git a/internal/dockerutil/volumeowner.go b/internal/dockerutil/volumeowner.go index d8ad269d5..6227194ee 100644 --- a/internal/dockerutil/volumeowner.go +++ b/internal/dockerutil/volumeowner.go @@ -32,7 +32,7 @@ func SetVolumeOwner(ctx context.Context, opts VolumeOwnerOptions) error { // Start a one-off container to chmod and chown the volume. - containerName := fmt.Sprintf("ibctest-volumeowner-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) + containerName := fmt.Sprintf("interchaintest-volumeowner-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) if err := ensureBusybox(ctx, opts.Client); err != nil { return err diff --git a/internal/mocktesting/doc.go b/internal/mocktesting/doc.go index 6171b6aff..b89cfe029 100644 --- a/internal/mocktesting/doc.go +++ b/internal/mocktesting/doc.go @@ -1,3 +1,3 @@ // Package mocktesting contains a mock instance of *testing.T -// which is useful for testing ibctest's interactions with Go tests. +// which is useful for testing interchaintest's interactions with Go tests. package mocktesting diff --git a/internal/mocktesting/t.go b/internal/mocktesting/t.go index ce21cf159..85ff58bcb 100644 --- a/internal/mocktesting/t.go +++ b/internal/mocktesting/t.go @@ -6,7 +6,7 @@ import ( "time" ) -// T satisfies a subset of testing.TB useful for tests around how ibctest interacts with instances of testing.T. +// T satisfies a subset of testing.TB useful for tests around how interchaintest interacts with instances of testing.T. // // The methods that are unique to T are RunCleanups and Simulate type T struct { diff --git a/internal/mocktesting/t_test.go b/internal/mocktesting/t_test.go index d4373e25e..7779487d2 100644 --- a/internal/mocktesting/t_test.go +++ b/internal/mocktesting/t_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/strangelove-ventures/ibctest/v7/internal/mocktesting" + "github.com/strangelove-ventures/interchaintest/v7/internal/mocktesting" "github.com/stretchr/testify/require" ) diff --git a/internal/version/version.go b/internal/version/version.go index de7d7d585..cb0702a27 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -1,5 +1,5 @@ package version // GitSha is the git commit that produced the executable. -// Set via the project Makefile `make ibctest`. +// Set via the project Makefile `make interchaintest`. var GitSha = "unknown" diff --git a/label/label.go b/label/label.go index 800f87da1..215917f60 100644 --- a/label/label.go +++ b/label/label.go @@ -44,7 +44,7 @@ func (l Relayer) IsKnown() bool { return exists } -// RegisterRelayerLabel is available for external packages that may import ibctest, +// RegisterRelayerLabel is available for external packages that may import interchaintest, // to register any external relayer implementations they may provide. func RegisterRelayerLabel(l Relayer) { if _, exists := knownRelayerLabels[l]; exists { @@ -85,7 +85,7 @@ var knownChainLabels = map[Chain]struct{}{ Penumbra: {}, } -// RegisterChainLabel is available for external packages that may import ibctest, +// RegisterChainLabel is available for external packages that may import interchaintest, // to register any external chain implementations they may provide. func RegisterChainLabel(l Chain) { if _, exists := knownChainLabels[l]; exists { diff --git a/relayer/capability.go b/relayer/capability.go index 6bf284ccc..820be4c14 100644 --- a/relayer/capability.go +++ b/relayer/capability.go @@ -2,15 +2,15 @@ package relayer //go:generate go run golang.org/x/tools/cmd/stringer -type=Capability -// While the relayer capability type may have made a little more sense inside the ibctest package, +// While the relayer capability type may have made a little more sense inside the interchaintest package, // we would expect individual relayer implementations to specify their own capabilities. -// The ibctest package depends on the relayer implementations, +// The interchaintest package depends on the relayer implementations, // therefore the relayer capability type exists here to avoid a circular dependency. // Capability indicates a relayer's support of a given feature. type Capability int -// The list of relayer capabilities that ibctest understands. +// The list of relayer capabilities that interchaintest understands. const ( TimestampTimeout Capability = iota HeightTimeout diff --git a/relayer/docker.go b/relayer/docker.go index 454c9e1e1..d8fc9b2da 100644 --- a/relayer/docker.go +++ b/relayer/docker.go @@ -15,8 +15,8 @@ import ( volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/client" "github.com/docker/docker/pkg/stdcopy" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "go.uber.org/zap" ) @@ -488,7 +488,7 @@ type RelayerCommander interface { DefaultContainerVersion() string // The Docker user to use in created container. - // For ibctest, must be of the format: uid:gid. + // For interchaintest, must be of the format: uid:gid. DockerUser() string // ConfigContent generates the content of the config file that will be passed to AddChainConfiguration. diff --git a/relayer/options.go b/relayer/options.go index 134622850..659140f30 100644 --- a/relayer/options.go +++ b/relayer/options.go @@ -1,7 +1,7 @@ package relayer import ( - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) // RelayerOption is used to customize the relayer configuration, whether constructed with the diff --git a/relayer/rly/cosmos_relayer.go b/relayer/rly/cosmos_relayer.go index 3714bedc0..57528d4d2 100644 --- a/relayer/rly/cosmos_relayer.go +++ b/relayer/rly/cosmos_relayer.go @@ -9,8 +9,8 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/relayer" "go.uber.org/zap" ) diff --git a/relayer/rly/wallet.go b/relayer/rly/wallet.go index 4da53110c..ddc853dc0 100644 --- a/relayer/rly/wallet.go +++ b/relayer/rly/wallet.go @@ -1,7 +1,7 @@ package rly import ( - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) var _ ibc.Wallet = &RlyWallet{} diff --git a/relayerfactory.go b/relayerfactory.go index 8a19a2a12..2dc271380 100644 --- a/relayerfactory.go +++ b/relayerfactory.go @@ -1,14 +1,14 @@ -package ibctest +package interchaintest import ( "fmt" "testing" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/label" - "github.com/strangelove-ventures/ibctest/v7/relayer" - "github.com/strangelove-ventures/ibctest/v7/relayer/rly" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/relayer" + "github.com/strangelove-ventures/interchaintest/v7/relayer/rly" "go.uber.org/zap" ) diff --git a/tempdir.go b/tempdir.go index 9b2948fe4..9fdf673fb 100644 --- a/tempdir.go +++ b/tempdir.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "fmt" @@ -26,7 +26,7 @@ type TempDirTestingT interface { // // The KeepTempDirOnFailure function is the public API to access this value. // We export the function instead of the package-level variable -// for a consistent API in ibctest with the KeepDockerVolumesOnFailure function, +// for a consistent API in interchaintest with the KeepDockerVolumesOnFailure function, // which references a variable in an internal package. var keepTempDirOnFailure = os.Getenv("IBCTEST_SKIP_FAILURE_CLEANUP") != "" @@ -35,7 +35,7 @@ var keepTempDirOnFailure = os.Getenv("IBCTEST_SKIP_FAILURE_CLEANUP") != "" // // The value is false by default, but can be initialized to true by setting the // environment variable IBCTEST_SKIP_FAILURE_CLEANUP to a non-empty value. -// Alternatively, importers of the ibctest package may set the variable to true. +// Alternatively, importers of the interchaintest package may set the variable to true. func KeepTempDirOnFailure(b bool) { keepTempDirOnFailure = b } diff --git a/tempdir_test.go b/tempdir_test.go index b3f138c2c..dc2979672 100644 --- a/tempdir_test.go +++ b/tempdir_test.go @@ -1,4 +1,4 @@ -package ibctest_test +package interchaintest_test import ( "os" @@ -6,24 +6,24 @@ import ( "strings" "testing" - ibctest "github.com/strangelove-ventures/ibctest/v7" - "github.com/strangelove-ventures/ibctest/v7/internal/mocktesting" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/internal/mocktesting" "github.com/stretchr/testify/require" ) func TestTempDir_Cleanup(t *testing.T) { - origKeep := ibctest.KeepingTempDirOnFailure() + origKeep := interchaintest.KeepingTempDirOnFailure() defer func() { - ibctest.KeepTempDirOnFailure(origKeep) + interchaintest.KeepTempDirOnFailure(origKeep) }() t.Run("keep=true", func(t *testing.T) { - ibctest.KeepTempDirOnFailure(true) + interchaintest.KeepTempDirOnFailure(true) t.Run("test passed", func(t *testing.T) { mt := mocktesting.NewT("t") - dir := ibctest.TempDir(mt) + dir := interchaintest.TempDir(mt) require.DirExists(t, dir) mt.RunCleanups() @@ -35,7 +35,7 @@ func TestTempDir_Cleanup(t *testing.T) { t.Run("test failed", func(t *testing.T) { mt := mocktesting.NewT("t") - dir := ibctest.TempDir(mt) + dir := interchaintest.TempDir(mt) require.DirExists(t, dir) defer func() { _ = os.RemoveAll(dir) }() @@ -53,7 +53,7 @@ func TestTempDir_Cleanup(t *testing.T) { }) t.Run("keep=false", func(t *testing.T) { - ibctest.KeepTempDirOnFailure(false) + interchaintest.KeepTempDirOnFailure(false) for name, failed := range map[string]bool{ "test passed": false, @@ -63,7 +63,7 @@ func TestTempDir_Cleanup(t *testing.T) { t.Run(name, func(t *testing.T) { mt := mocktesting.NewT("t") - dir := ibctest.TempDir(mt) + dir := interchaintest.TempDir(mt) require.DirExists(t, dir) if failed { @@ -92,7 +92,7 @@ func TestTempDir_Naming(t *testing.T) { } { wantDir := filepath.Join(tmpRoot, testNamePrefix+expDir) t.Run(name, func(t *testing.T) { - dir := ibctest.TempDir(t) + dir := interchaintest.TempDir(t) require.Truef( t, diff --git a/test_setup.go b/test_setup.go index 6a34658e2..7fcda58cd 100644 --- a/test_setup.go +++ b/test_setup.go @@ -1,4 +1,4 @@ -package ibctest +package interchaintest import ( "context" @@ -8,10 +8,10 @@ import ( "time" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/internal/version" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/internal/version" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" ) const ( @@ -25,7 +25,7 @@ const ( // // The value is false by default, but can be initialized to true by setting the // environment variable IBCTEST_SKIP_FAILURE_CLEANUP to a non-empty value. -// Alternatively, importers of the ibctest package may call KeepDockerVolumesOnFailure(true). +// Alternatively, importers of the interchaintest package may call KeepDockerVolumesOnFailure(true). func KeepDockerVolumesOnFailure(b bool) { dockerutil.KeepVolumesOnFailure = b } diff --git a/test_user.go b/test_user.go index 41ae60cc8..eb86f5992 100644 --- a/test_user.go +++ b/test_user.go @@ -1,13 +1,13 @@ -package ibctest +package interchaintest import ( "context" "fmt" "testing" - "github.com/strangelove-ventures/ibctest/v7/ibc" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" - "github.com/strangelove-ventures/ibctest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) diff --git a/testreporter/doc.go b/testreporter/doc.go index fddb8cbb6..5a06e7c85 100644 --- a/testreporter/doc.go +++ b/testreporter/doc.go @@ -9,7 +9,7 @@ // you will just miss some detail in the external report. // // First, the reporter instance must be initialized and Closed. -// The cmd/ibctest package does this in a MainTest function, similar to this: +// The cmd/interchaintest package does this in a MainTest function, similar to this: // // func TestMain(m *testing.M) { // f, _ := os.Create("/tmp/report.json") diff --git a/testreporter/messages.go b/testreporter/messages.go index 84c9c3500..ffa78cd60 100644 --- a/testreporter/messages.go +++ b/testreporter/messages.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/strangelove-ventures/ibctest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/label" ) // Message is the sentinel interface to all testreporter messages. @@ -19,7 +19,7 @@ type Message interface { type BeginSuiteMessage struct { StartedAt time.Time - // TODO: it would be nice to embed the ibctest commit in this message, + // TODO: it would be nice to embed the interchaintest commit in this message, // but while https://github.com/golang/go/issues/33976 is outstanding, // we'll have to fall back to ldflags to embed it. } diff --git a/testreporter/messages_test.go b/testreporter/messages_test.go index 922a8ba2d..7623fb841 100644 --- a/testreporter/messages_test.go +++ b/testreporter/messages_test.go @@ -6,8 +6,8 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/strangelove-ventures/ibctest/v7/label" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "github.com/stretchr/testify/require" ) diff --git a/testreporter/reporter.go b/testreporter/reporter.go index 8490b68d7..130205c18 100644 --- a/testreporter/reporter.go +++ b/testreporter/reporter.go @@ -6,7 +6,7 @@ import ( "io" "time" - "github.com/strangelove-ventures/ibctest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/label" ) // T is a subset of testing.TB, @@ -239,7 +239,7 @@ func NewNopReporter() *Reporter { return NewReporter(newNopWriteCloser()) } -// nopWriteCloser is a no-op io.WriteCloser used to satisfy the ibctest TestReporter type. +// nopWriteCloser is a no-op io.WriteCloser used to satisfy the interchaintest TestReporter type. // Because the relayer is used in-process, all logs are simply streamed to the test log. type nopWriteCloser struct { io.Writer diff --git a/testreporter/reporter_test.go b/testreporter/reporter_test.go index c09216602..a1e698515 100644 --- a/testreporter/reporter_test.go +++ b/testreporter/reporter_test.go @@ -8,9 +8,9 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/strangelove-ventures/ibctest/v7/internal/mocktesting" - "github.com/strangelove-ventures/ibctest/v7/label" - "github.com/strangelove-ventures/ibctest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v7/internal/mocktesting" + "github.com/strangelove-ventures/interchaintest/v7/label" + "github.com/strangelove-ventures/interchaintest/v7/testreporter" "github.com/stretchr/testify/require" ) diff --git a/testutil/poll_for_state.go b/testutil/poll_for_state.go index c62143430..d136bd94c 100644 --- a/testutil/poll_for_state.go +++ b/testutil/poll_for_state.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/davecgh/go-spew/spew" - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" ) var ErrNotFound = errors.New("not found") diff --git a/testutil/poll_for_state_test.go b/testutil/poll_for_state_test.go index 30e54018a..fb41a2f6f 100644 --- a/testutil/poll_for_state_test.go +++ b/testutil/poll_for_state_test.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/strangelove-ventures/ibctest/v7/ibc" + "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/stretchr/testify/require" ) diff --git a/testutil/toml.go b/testutil/toml.go index 6597a1c4d..7f382adf9 100644 --- a/testutil/toml.go +++ b/testutil/toml.go @@ -8,7 +8,7 @@ import ( "github.com/BurntSushi/toml" "github.com/docker/docker/client" - "github.com/strangelove-ventures/ibctest/v7/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v7/internal/dockerutil" "go.uber.org/zap" ) diff --git a/tools.go b/tools.go index 833888f4f..04b929303 100644 --- a/tools.go +++ b/tools.go @@ -4,7 +4,7 @@ // comes from the official Go wiki: // https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module -package ibctest +package interchaintest import ( _ "golang.org/x/tools/cmd/stringer"