Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into v0.47
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Feb 1, 2023
2 parents 91540a4 + 0bdc194 commit e0e4e0f
Show file tree
Hide file tree
Showing 109 changed files with 597 additions and 535 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @strangelove-ventures/ibctest-maintainers
* @strangelove-ventures/interchaintest-maintainers
2 changes: 1 addition & 1 deletion .github/workflows/strangelove-project-management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<div align="center">
<h1>ibctest</h1>
<h1>interchaintest</h1>

[![Go Reference](https://pkg.go.dev/badge/github.com/strangelove-ventures/[email protected])](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/[email protected])](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.
</div>

### -- Features --
Expand Down Expand Up @@ -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.

Expand All @@ -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)
- [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)
6 changes: 3 additions & 3 deletions chain/cosmos/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down
10 changes: 5 additions & 5 deletions chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions chain/cosmos/cosmos_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/osmosis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chain/cosmos/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
6 changes: 3 additions & 3 deletions chain/internal/tendermint/tendermint_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 19 additions & 5 deletions chain/penumbra/penumbra_app_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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") {
Expand All @@ -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(),
}
Expand Down
12 changes: 6 additions & 6 deletions chain/penumbra/penumbra_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion chain/penumbra/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion chain/polkadot/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions chain/polkadot/parachain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions chain/polkadot/polkadot_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Loading

0 comments on commit e0e4e0f

Please sign in to comment.