Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(stride): Add stride outpost unit testing setup #1931

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ics20) [#1916](https://github.com/evmos/evmos/pull/1916) Make ICS20 Transfer event a common function.
- (ics20) [#1917](https://github.com/evmos/evmos/pull/1917) Make timeout height a const in the ics20 precompile.
- (stride-outpost) [#1926](https://github.com/evmos/evmos/pull/1926) Refactor event names and definitions.
- (stride-outpost) [#1931](https://github.com/evmos/evmos/pull/1931) Add Stride unit testing setup.

### Bug Fixes

Expand Down
71 changes: 71 additions & 0 deletions precompiles/outposts/stride/setup_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright Tharsis Labs Ltd.(Evmos)
// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)

package stride_test

import (
"testing"
"time"

"github.com/evmos/evmos/v15/precompiles/outposts/stride"

tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
evmosapp "github.com/evmos/evmos/v15/app"
evmosibc "github.com/evmos/evmos/v15/ibc/testing"
"github.com/evmos/evmos/v15/x/evm/statedb"
evmtypes "github.com/evmos/evmos/v15/x/evm/types"

. "github.com/onsi/ginkgo/v2"

Check warning on line 25 in precompiles/outposts/stride/setup_test.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

dot-imports: should not use dot imports (revive)
. "github.com/onsi/gomega"

Check warning on line 26 in precompiles/outposts/stride/setup_test.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

dot-imports: should not use dot imports (revive)
"github.com/stretchr/testify/suite"
)

var s *PrecompileTestSuite

type PrecompileTestSuite struct {
suite.Suite

ctx sdk.Context
app *evmosapp.Evmos
address common.Address
differentAddr common.Address
validators []stakingtypes.Validator
valSet *tmtypes.ValidatorSet
ethSigner ethtypes.Signer
privKey cryptotypes.PrivKey
signer keyring.Signer
bondDenom string

precompile *stride.Precompile
stateDB *statedb.StateDB

coordinator *ibctesting.Coordinator
chainA *ibctesting.TestChain
chainB *ibctesting.TestChain
transferPath *evmosibc.Path
queryClientEVM evmtypes.QueryClient

defaultExpirationDuration time.Time

suiteIBCTesting bool
}

func TestPrecompileTestSuite(t *testing.T) {
s = new(PrecompileTestSuite)
suite.Run(t, s)

// Run Ginkgo integration tests
RegisterFailHandler(Fail)
RunSpecs(t, "ICS20 Precompile Suite")
}

func (s *PrecompileTestSuite) SetupTest() {
s.DoSetupTest()
}