Skip to content

Commit

Permalink
chore: Working tests and Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird committed Jan 17, 2025
1 parent 213acc2 commit 26efeab
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 2,446 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"

"github.com/CosmWasm/wasmd/tests/e2e"
wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
ibctesting "github.com/cosmos/ibc-go/v9/testing"
)

Expand All @@ -26,7 +26,7 @@ func TestGovVoteByContract(t *testing.T) {
// When the contract sends a vote for the proposal
// Then the vote is taken into account

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
contractAddr := e2e.InstantiateReflectContract(t, &chain)
chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000))
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/grants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/authz"

"github.com/CosmWasm/wasmd/tests/e2e"
wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
ibctesting "github.com/cosmos/ibc-go/v9/testing"
)
Expand All @@ -34,7 +34,7 @@ func TestGrants(t *testing.T) {
// - balance A reduced (on success)
// - balance B not touched

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
contractAddr := e2e.InstantiateReflectContract(t, &chain)
require.NotEmpty(t, contractAddr)
Expand Down Expand Up @@ -131,7 +131,7 @@ func TestStoreCodeGrant(t *testing.T) {
reflectCodeChecksum, err := wasmvm.CreateChecksum(reflectWasmCode)
require.NoError(t, err)

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))

granterAddr := chain.SenderAccount.GetAddress()
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestGzipStoreCodeGrant(t *testing.T) {
hackatomCodeChecksum, err := wasmvm.CreateChecksum(hackatomWasmCode)
require.NoError(t, err)

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))

granterAddr := chain.SenderAccount.GetAddress()
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestBrokenGzipStoreCodeGrant(t *testing.T) {
brokenGzipWasmCode, err := os.ReadFile("../../x/wasm/keeper/testdata/broken_crc.gzip")
require.NoError(t, err)

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))

granterAddr := chain.SenderAccount.GetAddress()
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/group"

"github.com/CosmWasm/wasmd/tests/e2e"
wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
ibctesting "github.com/cosmos/ibc-go/v9/testing"
)
Expand All @@ -26,7 +26,7 @@ func TestGroupWithContract(t *testing.T) {
// When contract submits a proposal with try_execute
// Then the payload msg is executed

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
contractAddr := e2e.InstantiateStargateReflectContract(t, &chain)
chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000))
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestGroupWithNewReflectContract(t *testing.T) {
// When contract submits a proposal with try_execute
// Then the payload msg is executed

coord := wasmibctesting.NewCoordinator2(t, 1)
coord := wasmibctesting.NewCoordinator(t, 1)
chain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
contractAddr := e2e.InstantiateReflectContract(t, &chain)
chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000))
Expand Down
14 changes: 7 additions & 7 deletions tests/e2e/ibc_callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/tests/e2e"
wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
)

Expand All @@ -33,9 +33,9 @@ func TestIBCCallbacks(t *testing.T) {
// then the contract on B should receive a destination chain callback
// and the contract on A should receive a source chain callback with the result (ack or timeout)
marshaler := app.MakeEncodingConfig(t).Codec
coord := wasmibctesting.NewCoordinator2(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(wasmibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(wasmibctesting.GetChainID(2)))
coord := wasmibctesting.NewCoordinator(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(2)))

actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address())
oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1)))
Expand Down Expand Up @@ -178,9 +178,9 @@ func TestIBCCallbacksWithoutEntrypoints(t *testing.T) {
// then the VM should try to call the callback on B and fail gracefully
// and should try to call the callback on A and fail gracefully
marshaler := app.MakeEncodingConfig(t).Codec
coord := wasmibctesting.NewCoordinator2(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(wasmibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(wasmibctesting.GetChainID(2)))
coord := wasmibctesting.NewCoordinator(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(2)))

oneToken := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))

Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/ibc_fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"strings"

"github.com/CosmWasm/wasmd/app"
wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)

Expand All @@ -50,9 +50,9 @@ func TestIBCFeesTransfer(t *testing.T) {
// when an ics-29 fee is attached to an ibc package
// then the relayer's payee is receiving the fee(s) on success
marshaler := app.MakeEncodingConfig(t).Codec
coord := wasmibctesting.NewCoordinator2(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(wasmibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(wasmibctesting.GetChainID(2)))
coord := wasmibctesting.NewCoordinator(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(2)))

actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address())
actorChainB := sdk.AccAddress(chainB.SenderPrivKey.PubKey().Address())
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestIBCFeesWasm(t *testing.T) {
// when an ics-29 fee is attached to an ibc package
// then the relayer's payee is receiving the fee(s) on success
marshaler := app.MakeEncodingConfig(t).Codec
coord := wasmibctesting.NewCoordinator2(t, 2)
coord := wasmibctesting.NewCoordinator(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(2)))
actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address())
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestIBCFeesReflect(t *testing.T) {
// then the relayer's payee is receiving the fee(s) on success

marshaler := app.MakeEncodingConfig(t).Codec
coord := wasmibctesting.NewCoordinator2(t, 2)
coord := wasmibctesting.NewCoordinator(t, 2)
chainA := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
chainB := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(2)))
actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address())
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/ica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/address"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
)

func TestICA(t *testing.T) {
Expand All @@ -32,7 +32,7 @@ func TestICA(t *testing.T) {
// and the channel is established to the host chain
// then the ICA owner can submit a message via IBC
// to control their account on the host chain
coord := wasmibctesting.NewCoordinator2(t, 2)
coord := wasmibctesting.NewCoordinator(t, 2)
hostChain := wasmibctesting.NewWasmTestChain(coord.GetChain(ibctesting.GetChainID(1)))
hostParams := hosttypes.NewParams(true, []string{sdk.MsgTypeURL(&banktypes.MsgSend{})})
hostApp := hostChain.GetWasmApp()
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/reflect_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"

wasmibctesting "github.com/CosmWasm/wasmd/tests/ibctesting"
wasmibctesting "github.com/CosmWasm/wasmd/tests/wasmibctesting"
"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
Expand Down
Loading

0 comments on commit 26efeab

Please sign in to comment.