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

Add system tests #1411

Merged
merged 11 commits into from
Jun 14, 2023
Merged

Add system tests #1411

merged 11 commits into from
Jun 14, 2023

Conversation

pinosu
Copy link
Contributor

@pinosu pinosu commented May 18, 2023

No description provided.

@@ -263,7 +263,7 @@ func (c WasmdCli) QuerySmart(contractAddr, msg string, args ...string) string {
}

// QueryBalances queries all balances for an account. Returns json response
// Example:`{"balances":[{"denom":"node0token","amount":"1000000000"},{"denom":"utgd","amount":"400000003"}],"pagination":{}}`
// Example:`{"balances":[{"denom":"node0token","amount":"1000000000"},{"denom":"ustake","amount":"400000003"}],"pagination":{}}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good 👁️ ! Please use stake here and everywhere else instead of ustake. stake is the sdk.DefaultBondDenom` .

Suggested change
// Example:`{"balances":[{"denom":"node0token","amount":"1000000000"},{"denom":"ustake","amount":"400000003"}],"pagination":{}}`
// Example:`{"balances":[{"denom":"node0token","amount":"1000000000"},{"denom":"stake","amount":"400000003"}],"pagination":{}}`

@@ -284,23 +284,6 @@ func (c WasmdCli) QueryTotalSupply(denom string) int64 {
return gjson.Get(raw, "amount").Int()
}

// QueryValidator queries the validator for the given operator address. Returns json response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Merging #1411 (ce088d9) into 1362_tests (ef25457) will decrease coverage by 0.12%.
The diff coverage is 0.00%.

❗ Current head ce088d9 differs from pull request most recent head 2f5888c. Consider uploading reports for the commit 2f5888c to get more accurate results

Impacted file tree graph

@@              Coverage Diff               @@
##           1362_tests    #1411      +/-   ##
==============================================
- Coverage       60.14%   60.03%   -0.12%     
==============================================
  Files              60       61       +1     
  Lines            7557     7571      +14     
==============================================
  Hits             4545     4545              
- Misses           2676     2690      +14     
  Partials          336      336              
Impacted Files Coverage Δ
x/wasm/client/cli/new_tx.go 0.00% <0.00%> (ø)
x/wasm/client/cli/utils.go 0.00% <0.00%> (ø)

Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress! 👏

@@ -95,6 +95,20 @@ jobs:
- "profiles/*"
- store_artifacts:
path: /tmp/logs

test-system:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -31,6 +32,7 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/viper"
tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ There should not be any dependency to tendermint. All is in CometBFT now.

@@ -302,3 +305,26 @@ func appExport(

return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport)
}

// extendUnsafeResetAllCmd - also clear wasm dir
func extendUnsafeResetAllCmd(rootCmd *cobra.Command) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, you copied this over already. I had opened #1414 for this.

I was wondering if we want this here or in x/wasm/cli ?

go.mod Outdated
@@ -40,6 +40,7 @@ require (
github.com/cometbft/cometbft v0.37.1
github.com/cometbft/cometbft-db v0.7.0
github.com/spf13/viper v1.15.0
github.com/tendermint/tendermint v0.35.9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This is CometBFT now

@@ -142,7 +142,7 @@ func UpdateInstantiateConfigCmd() *cobra.Command {
}

msg := types.MsgUpdateInstantiateConfig{
Sender: string(clientCtx.GetFromAddress()),
Sender: clientCtx.GetFromAddress().String(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Can you backport this for v0.40?


qResult = cli.CustomQuery("q", "wasm", "contract", newContractAddr)
actualAdmin := gjson.Get(qResult, "contract_info.admin").String()
assert.Equal(t, newAdmin, actualAdmin)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good tests!

@@ -256,14 +256,36 @@ func (c WasmdCli) WasmInstantiate(codeID int, initMsg string, args ...string) st
return addr
}

// Stake delegates amount to given validator
func (c WasmdCli) Stake(validatorAddr, amount string, args ...string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 We should be careful to not blow up the CLI with too many features. If this is some common command then let's add it here to make the tests more readable otherwise it is better to have them in the test itself.

assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(200000002))), getGenesisBalance([]byte(raw), vest3Addr))
}

func TestStakeUnstake(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to a new file. How about staking_tests.go ?

})
}

func TestVestingAccounts(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was a some work to port it. I would have skipped this test as it is testing the genesis generation only, which is not part of wasmd.

)

func TestRecursiveMsgsExternalTrigger(t *testing.T) {
t.Skip()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is WIP ?

@alpe alpe marked this pull request as ready for review June 14, 2023 12:15
@alpe alpe merged commit 20c753d into 1362_tests Jun 14, 2023
@alpe alpe deleted the 1362_tests_update branch June 14, 2023 12:16
alpe added a commit that referenced this pull request Jun 15, 2023
* Start system tests

* Go mod tidy

* Add system tests (#1411)

* Add tests

* Add test-system to CI

* Fix path

* Remove store artifact steps

* Add small fixes

* Add stake/unstake tests

* Add unsafe-reset-all extention + system test

* Replace ustake with stake

* Add more tests + fix bug in cli

* Fix comments and add multi contract system test

* Updates and fixes to system tests (#1449)

* Updates

* Minor cleanup

* Make tests pass

---------

Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>

* Fix Makefile to return exit code for system tests (#1450)

* Abort on error results

---------

Co-authored-by: pinosu <95283998+pinosu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants