Skip to content

Commit

Permalink
seperate interchaintest to pr quicksilver-zone#521
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanhNhann committed Aug 16, 2023
1 parent 950d879 commit 2776e84
Show file tree
Hide file tree
Showing 7 changed files with 316 additions and 1,400 deletions.
6 changes: 3 additions & 3 deletions test/interchaintest/chain_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"testing"

"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/testreporter"
"github.com/strangelove-ventures/interchaintest/v5"
"github.com/strangelove-ventures/interchaintest/v5/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v5/testreporter"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down
191 changes: 79 additions & 112 deletions test/interchaintest/go.mod

Large diffs are not rendered by default.

982 changes: 89 additions & 893 deletions test/interchaintest/go.sum

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test/interchaintest/ibc_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"fmt"
"testing"

transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
"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"
transfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
"github.com/strangelove-ventures/interchaintest/v5"
"github.com/strangelove-ventures/interchaintest/v5/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v5/ibc"
"github.com/strangelove-ventures/interchaintest/v5/testreporter"
"github.com/strangelove-ventures/interchaintest/v5/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down
241 changes: 120 additions & 121 deletions test/interchaintest/interchainstaking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"
"testing"

"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/strangelove-ventures/interchaintest/v5"
"github.com/strangelove-ventures/interchaintest/v5/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v5/ibc"
"github.com/strangelove-ventures/interchaintest/v5/testreporter"
"github.com/strangelove-ventures/interchaintest/v5/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down Expand Up @@ -116,121 +116,120 @@ func TestInterchainStaking(t *testing.T) {
_ = quickUserAddr
_ = junoUserAddr

// runSidecars(t, ctx, quicksilver, juno)
runSidecars(t, ctx, quicksilver, juno)
}

// TODO: Need add SideCar to interchain-test v7
// func runSidecars(t *testing.T, ctx context.Context, quicksilver, juno *cosmos.CosmosChain) {
// t.Helper()

// runICQ(t, ctx, quicksilver, juno)
// // runXCC(t, ctx, quicksilver, juno)
// }

// func runICQ(t *testing.T, ctx context.Context, quicksilver, juno *cosmos.CosmosChain) {
// t.Helper()

// var icq *cosmos.SidecarProcess
// for _, sidecar := range quicksilver.Sidecars {
// if sidecar.ProcessName == "icq" {
// icq = sidecar
// }
// }
// require.NotNil(t, icq)

// containerCfg := "config.yaml"

// file := fmt.Sprintf(`default_chain: '%s'
// chains:
// '%s':
// key: default
// chain-id: '%s'
// rpc-addr: '%s'
// grpc-addr: '%s'
// account-prefix: quick
// keyring-backend: test
// gas-adjustment: 1.2
// gas-prices: 0.01uqck
// min-gas-amount: 0
// key-directory: %s/.icq/keys
// debug: false
// timeout: 20s
// block-timeout: 10s
// output-format: json
// sign-mode: direct
// '%s':
// key: default
// chain-id: '%s'
// rpc-addr: '%s'
// grpc-addr: '%s'
// account-prefix: osmo
// keyring-backend: test
// gas-adjustment: 1.2
// gas-prices: 0.01uosmo
// min-gas-amount: 0
// key-directory: %s/.icq/keys
// debug: false
// timeout: 20s
// block-timeout: 10s
// output-format: json
// sign-mode: direct
// `,
// quicksilver.Config().ChainID,
// quicksilver.Config().ChainID,
// quicksilver.Config().ChainID,
// quicksilver.GetRPCAddress(),
// quicksilver.GetGRPCAddress(),
// icq.HomeDir(),
// juno.Config().ChainID,
// juno.Config().ChainID,
// juno.GetRPCAddress(),
// juno.GetGRPCAddress(),
// icq.HomeDir(),
// )

// err := icq.WriteFile(ctx, []byte(file), containerCfg)
// require.NoError(t, err)
// _, err = icq.ReadFile(ctx, containerCfg)
// require.NoError(t, err)

// err = icq.StartContainer(ctx)
// require.NoError(t, err)

// err = icq.Running(ctx)
// require.NoError(t, err)
// }

// func runXCC(t *testing.T, ctx context.Context, quicksilver, juno *cosmos.CosmosChain) {
// t.Helper()

// var xcc *cosmos.SidecarProcess
// for _, sidecar := range quicksilver.Sidecars {
// if sidecar.ProcessName == "xcc" {
// xcc = sidecar
// }
// }
// require.NotNil(t, xcc)

// containerCfg := "config.yaml"

// file := fmt.Sprintf(`source_chain: '%s'
// chains:
// quick-1: '%s'
// juno-1: '%s'
// `,
// quicksilver.Config().ChainID,
// quicksilver.GetRPCAddress(),
// juno.GetRPCAddress(),
// )

// err := xcc.WriteFile(ctx, []byte(file), containerCfg)
// require.NoError(t, err)
// _, err = xcc.ReadFile(ctx, containerCfg)
// require.NoError(t, err)

// err = xcc.StartContainer(ctx)
// require.NoError(t, err)

// err = xcc.Running(ctx)
// require.NoError(t, err)
// }
func runSidecars(t *testing.T, ctx context.Context, quicksilver, juno *cosmos.CosmosChain) {
t.Helper()

runICQ(t, ctx, quicksilver, juno)
// runXCC(t, ctx, quicksilver, juno)
}

func runICQ(t *testing.T, ctx context.Context, quicksilver, juno *cosmos.CosmosChain) {
t.Helper()

var icq *cosmos.SidecarProcess
for _, sidecar := range quicksilver.Sidecars {
if sidecar.ProcessName == "icq" {
icq = sidecar
}
}
require.NotNil(t, icq)

containerCfg := "config.yaml"

file := fmt.Sprintf(`default_chain: '%s'
chains:
'%s':
key: default
chain-id: '%s'
rpc-addr: '%s'
grpc-addr: '%s'
account-prefix: quick
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0.01uqck
min-gas-amount: 0
key-directory: %s/.icq/keys
debug: false
timeout: 20s
block-timeout: 10s
output-format: json
sign-mode: direct
'%s':
key: default
chain-id: '%s'
rpc-addr: '%s'
grpc-addr: '%s'
account-prefix: osmo
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0.01uosmo
min-gas-amount: 0
key-directory: %s/.icq/keys
debug: false
timeout: 20s
block-timeout: 10s
output-format: json
sign-mode: direct
`,
quicksilver.Config().ChainID,
quicksilver.Config().ChainID,
quicksilver.Config().ChainID,
quicksilver.GetRPCAddress(),
quicksilver.GetGRPCAddress(),
icq.HomeDir(),
juno.Config().ChainID,
juno.Config().ChainID,
juno.GetRPCAddress(),
juno.GetGRPCAddress(),
icq.HomeDir(),
)

err := icq.WriteFile(ctx, []byte(file), containerCfg)
require.NoError(t, err)
_, err = icq.ReadFile(ctx, containerCfg)
require.NoError(t, err)

err = icq.StartContainer(ctx)
require.NoError(t, err)

err = icq.Running(ctx)
require.NoError(t, err)
}

func runXCC(t *testing.T, ctx context.Context, quicksilver, juno *cosmos.CosmosChain) {
t.Helper()

var xcc *cosmos.SidecarProcess
for _, sidecar := range quicksilver.Sidecars {
if sidecar.ProcessName == "xcc" {
xcc = sidecar
}
}
require.NotNil(t, xcc)

containerCfg := "config.yaml"

file := fmt.Sprintf(`source_chain: '%s'
chains:
quick-1: '%s'
juno-1: '%s'
`,
quicksilver.Config().ChainID,
quicksilver.GetRPCAddress(),
juno.GetRPCAddress(),
)

err := xcc.WriteFile(ctx, []byte(file), containerCfg)
require.NoError(t, err)
_, err = xcc.ReadFile(ctx, containerCfg)
require.NoError(t, err)

err = xcc.StartContainer(ctx)
require.NoError(t, err)

err = xcc.Running(ctx)
require.NoError(t, err)
}
Loading

0 comments on commit 2776e84

Please sign in to comment.