Skip to content

Commit

Permalink
chore: fixing testsuite tests by upgrade to new fixtures and signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
JeancarloBarrios committed Jun 26, 2024
1 parent 64830cc commit d3836f2
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/client/cli/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestInitCmd(t *testing.T) {
err = os.Mkdir(nodeHome, 0755)
require.NoError(t, err)

rootCmd, _ := cli.NewRootCmd()
rootCmd := cli.NewRootCmd()
rootCmd.SetArgs([]string{
"init",
"test",
Expand Down
23 changes: 10 additions & 13 deletions app/testsuite/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"
dbm "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/require"

"github.com/cometbft/cometbft/libs/log"

"github.com/regen-network/regen-ledger/v5/app"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
encCfg := app.MakeEncodingConfig()
db := dbm.NewMemDB()
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
regenApp := NewAppWithCustomOptions(t, false, SetupOptions{
Logger: logger,
DB: db,
InvCheckPeriod: 0,
EncConfig: encCfg,
HomePath: app.DefaultNodeHome,
SkipUpgradeHeights: map[int64]bool{},
AppOpts: EmptyAppOptions{},
})
setupOptions := SetupOptions{
Logger: logger,
DB: db,
InvCheckPeriod: 0,
AppOpts: EmptyAppOptions{},
}
regenApp := NewAppWithCustomOptions(t, false, setupOptions)

for acc := range app.GetMaccPerms() {
require.Equal(t, true, regenApp.BankKeeper.BlockedAddr(regenApp.AccountKeeper.GetModuleAddress(acc)),
Expand All @@ -34,7 +31,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {
regenApp.Commit()

// Making a new app object with the db, so that initchain hasn't been called
app2 := app.NewRegenApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, app.DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
_, err := app2.ExportAppStateAndValidators(false, []string{})
app2 := app.NewRegenApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, setupOptions.InvCheckPeriod, EmptyAppOptions{})
_, err := app2.ExportAppStateAndValidators(false, []string{}, []string{})
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
}
5 changes: 3 additions & 2 deletions app/testsuite/modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ package testsuite
import (
"testing"

"github.com/cosmos/cosmos-sdk/testutil/network"
"github.com/stretchr/testify/suite"

data "github.com/regen-network/regen-ledger/x/data/v3/client/testsuite"
ecocredit "github.com/regen-network/regen-ledger/x/ecocredit/v3/client/testsuite"
)

func TestDataIntegration(t *testing.T) {
cfg := DefaultConfig()
cfg := network.DefaultConfig(NewTestNetworkFixture)
suite.Run(t, data.NewIntegrationTestSuite(cfg))
}

func TestEcocreditIntegration(t *testing.T) {
cfg := DefaultConfig()
cfg := network.DefaultConfig(NewTestNetworkFixture)
suite.Run(t, ecocredit.NewIntegrationTestSuite(cfg))
}
2 changes: 1 addition & 1 deletion scripts/generate_cli_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// generate documentation for all regen app commands
func main() {
rootCmd, _ := cli.NewRootCmd()
rootCmd := cli.NewRootCmd()
err := doc.GenMarkdownTree(rootCmd, "commands")
if err != nil {
log.Fatal(err)
Expand Down
37 changes: 37 additions & 0 deletions scripts/start_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Set environment variables
export coins="10000000000stake,100000000000samoleans"
export coinsV="5000000000stake"
export REGEN_KEYRING_BACKEND=test
export CHAINID=regen-local
export TMCFG=~/.regen/config/config.toml
export APPCFG=~/.regen/config/app.toml

# Remove existing regen configuration
rm -rf ~/.regen

# Add a new key for the validator
./build/regen keys add validator --keyring-backend test

# Initialize the chain
./build/regen init dev-val --chain-id $CHAINID

# Add genesis account
./build/regen genesis add-genesis-account validator --keyring-backend test $coins

# Generate a genesis transaction
./build/regen genesis gentx validator $coinsV --chain-id $CHAINID --keyring-backend test

# Collect genesis transactions
./build/regen genesis collect-gentxs

# Validate genesis file
./build/regen genesis validate-genesis

# Modify configuration files
perl -i -pe 's|timeout_commit = ".*?"|timeout_commit = "2s"|g' $TMCFG
perl -i -pe 's|minimum-gas-prices = ""|minimum-gas-prices = "0stake"|g' $APPCFG

# Start the node
./build/regen start --api.enable true --grpc.address="0.0.0.0:9090"

0 comments on commit d3836f2

Please sign in to comment.