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

style: s instead of suite #5222

Merged
merged 3 commits into from
May 18, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ On the function you want to generate a unit test for, right click the function n
This type of test is mainly for functions that would be triggered by incoming messages (we interact directly with the message server since all other metadata is stripped from a message by the time it hits the msg_server):

```go
func(suite *KeeperTestSuite) TestCreateDenom() {
func(s *KeeperTestSuite) TestCreateDenom() {
testCases := map[string] struct {
subdenom string
expectError bool
Expand Down Expand Up @@ -157,7 +157,7 @@ This type of test is mainly for functions that would be triggered by other modul
// TestMintExportGenesis tests that genesis is exported correctly.
// It first initializes genesis to the expected value. Then, attempts
// to export it. Lastly, compares exported to the expected.
func(suite *KeeperTestSuite) TestMintExportGenesis() {
func(s *KeeperTestSuite) TestMintExportGenesis() {
testCases := map[string] struct {
expectedGenesis *types.GenesisState
} {
Expand Down
2 changes: 1 addition & 1 deletion osmomath/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ require (
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.15.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion osmomath/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM=
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
2 changes: 1 addition & 1 deletion osmoutils/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ require (
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.15.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion osmoutils/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM=
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
2 changes: 1 addition & 1 deletion tests/cl-genesis-positions/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
github.com/cosmos/cosmos-sdk v0.47.2
github.com/ignite/cli v0.23.0
github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230511015306-615fa4fcbe56
// this commit points to https://github.com/osmosis-labs/osmosis/commit/6e8fbee70d9067b69a900cfc7441b5c4185ec495
github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90
github.com/tendermint/tendermint v0.34.26
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae
)

require (
Expand Down
4 changes: 2 additions & 2 deletions tests/cl-go-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111 // indirect
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae // indirect
github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230516205127-c213fddde069 // indirect
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230516205127-c213fddde069 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
6 changes: 2 additions & 4 deletions tests/cl-go-client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,8 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=
github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230326212251-7a2cf2993434 h1:RetElHdhDl6f00Tjj7ii2r+HX2aa/u+dhgwQb5hKv8Y=
github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230326212251-7a2cf2993434/go.mod h1:ss3tUfPTwaa6NsoPZrCR7xOqLqCK0LwoNbc2Q8Zs5/Y=
github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111 h1:1ahWbf9iF9sxDOjxrHWFaBGLE0nWFdpiX1pqObUaJO8=
github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111/go.mod h1:a7lhiXRpn8QJ21OhFpaEnUNErTSIafaYpp02q6uI/Dk=
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae h1:I1Cy+GpTPWbVi0lBw9+bS1w42YfQjvXNK9bW4YbHhcs=
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae/go.mod h1:hk/o9/kmTSZmZqwXcSrPuwj/gpRMCqbE/d3vj6teL2A=
github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230516205127-c213fddde069 h1:ZgDrTJ2GCH4CJGbV6rudw4O9rPMAuwWoLVZnG6cUr+A=
github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230516205127-c213fddde069 h1:9C/n+Nx5rre/AHPMlPsQrk1isgydrCNB68aqer86ygE=
github.com/osmosis-labs/osmosis/x/epochs v0.0.0-20230328024000-175ec88e4304 h1:RIrWLzIiZN5Xd2JOfSOtGZaf6V3qEQYg6EaDTAkMnCo=
github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230331072320-5d6f6cfa2627 h1:A0SwZgp4bmJFbivYJc8mmVhMjrr3EdUZluBYFke11+w=
github.com/osmosis-labs/wasmd v0.31.0-osmo-v16 h1:X747cZYdnqc/+RV48iPVeGprpVb/fUWSaKGsZUWrdbg=
Expand Down
58 changes: 29 additions & 29 deletions x/concentrated-liquidity/fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,13 @@ func (s *KeeperTestSuite) TestCalculateFeeGrowth() {
}
}

func (suite *KeeperTestSuite) TestGetInitialFeeGrowthOppositeDirectionOfLastTraversalForTick() {
func (s *KeeperTestSuite) TestGetInitialFeeGrowthOppositeDirectionOfLastTraversalForTick() {
const (
validPoolId = 1
)

initialPoolTick, err := math.PriceToTickRoundDown(DefaultAmt1.ToDec().Quo(DefaultAmt0.ToDec()), DefaultTickSpacing)
suite.Require().NoError(err)
s.Require().NoError(err)

tests := map[string]struct {
poolId uint64
Expand Down Expand Up @@ -541,65 +541,65 @@ func (suite *KeeperTestSuite) TestGetInitialFeeGrowthOppositeDirectionOfLastTrav

for name, tc := range tests {
tc := tc
suite.Run(name, func() {
suite.SetupTest()
ctx := suite.Ctx
clKeeper := suite.App.ConcentratedLiquidityKeeper
s.Run(name, func() {
s.SetupTest()
ctx := s.Ctx
clKeeper := s.App.ConcentratedLiquidityKeeper

pool, err := clmodel.NewConcentratedLiquidityPool(validPoolId, ETH, USDC, DefaultTickSpacing, DefaultZeroSwapFee)
suite.Require().NoError(err)
s.Require().NoError(err)

// N.B.: we set the listener mock because we would like to avoid
// utilizing the production listeners. The production listeners
// are irrelevant in the context of the system under test. However,
// setting them up would require compromising being able to set up other
// edge case tests. For example, the test case where fee accumulator
// is not initialized.
suite.setListenerMockOnConcentratedLiquidityKeeper()
s.setListenerMockOnConcentratedLiquidityKeeper()

err = clKeeper.SetPool(ctx, &pool)
suite.Require().NoError(err)
s.Require().NoError(err)

if !tc.shouldAvoidCreatingAccum {
err = clKeeper.CreateFeeAccumulator(ctx, validPoolId)
suite.Require().NoError(err)
s.Require().NoError(err)

// Setup test position to make sure that tick is initialized
// We also set up uptime accums to ensure position creation works as intended
err = clKeeper.CreateUptimeAccumulators(ctx, validPoolId)
suite.Require().NoError(err)
suite.SetupDefaultPosition(validPoolId)
s.Require().NoError(err)
s.SetupDefaultPosition(validPoolId)

err = clKeeper.ChargeFee(ctx, validPoolId, tc.initialGlobalFeeGrowth)
suite.Require().NoError(err)
s.Require().NoError(err)
}

// System under test.
initialFeeGrowthOppositeDirectionOfLastTraversal, err := clKeeper.GetInitialFeeGrowthOppositeDirectionOfLastTraversalForTick(ctx, tc.poolId, tc.tick)

if tc.expectError != nil {
suite.Require().Error(err)
suite.Require().ErrorIs(err, tc.expectError)
s.Require().Error(err)
s.Require().ErrorIs(err, tc.expectError)
return
}
suite.Require().NoError(err)
suite.Require().Equal(tc.expectedInitialFeeGrowthOppositeDirectionOfLastTraversal, initialFeeGrowthOppositeDirectionOfLastTraversal)
s.Require().NoError(err)
s.Require().Equal(tc.expectedInitialFeeGrowthOppositeDirectionOfLastTraversal, initialFeeGrowthOppositeDirectionOfLastTraversal)
})
}
}

func (suite *KeeperTestSuite) TestChargeFee() {
func (s *KeeperTestSuite) TestChargeFee() {
// setup once at the beginning.
suite.SetupTest()
s.SetupTest()

ctx := suite.Ctx
clKeeper := suite.App.ConcentratedLiquidityKeeper
ctx := s.Ctx
clKeeper := s.App.ConcentratedLiquidityKeeper

// create fee accumulators with ids 1 and 2 but not 3.
err := clKeeper.CreateFeeAccumulator(ctx, 1)
suite.Require().NoError(err)
s.Require().NoError(err)
err = clKeeper.CreateFeeAccumulator(ctx, 2)
suite.Require().NoError(err)
s.Require().NoError(err)

tests := []struct {
name string
Expand Down Expand Up @@ -641,20 +641,20 @@ func (suite *KeeperTestSuite) TestChargeFee() {

for _, tc := range tests {
tc := tc
suite.Run(tc.name, func() {
s.Run(tc.name, func() {
// System under test.
err := clKeeper.ChargeFee(ctx, tc.poolId, tc.feeUpdate)

if tc.expectError != nil {
suite.Require().Error(err)
suite.Require().ErrorIs(err, tc.expectError)
s.Require().Error(err)
s.Require().ErrorIs(err, tc.expectError)
return
}
suite.Require().NoError(err)
s.Require().NoError(err)

feeAcumulator, err := clKeeper.GetFeeAccumulator(ctx, tc.poolId)
suite.Require().NoError(err)
suite.Require().Equal(tc.expectedGlobalGrowth, feeAcumulator.GetValue())
s.Require().NoError(err)
s.Require().Equal(tc.expectedGlobalGrowth, feeAcumulator.GetValue())
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions x/concentrated-liquidity/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(KeeperTestSuite))
}

func (suite *KeeperTestSuite) SetupTest() {
suite.Setup()
func (s *KeeperTestSuite) SetupTest() {
s.Setup()
}

func (s *KeeperTestSuite) SetupDefaultPosition(poolId uint64) {
Expand Down
Loading