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

test: Fix gosec errors in mbt #1560

Merged
merged 1 commit into from
Jan 11, 2024
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
10 changes: 8 additions & 2 deletions tests/mbt/driver/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ func (s *Driver) delegate(val, amt int64) {
d := s.delegator()
v := s.validator(val)
msg := stakingtypes.NewMsgDelegate(d, v, coin)
server.Delegate(sdk.WrapSDKContext(s.ctx(PROVIDER)), msg)
_, err := server.Delegate(sdk.WrapSDKContext(s.ctx(PROVIDER)), msg)
if err != nil {
log.Println("error when delegating (is this expected?): ", err)
}
}

// undelegate undelegates amt tokens from validator val
Expand All @@ -160,7 +163,10 @@ func (s *Driver) undelegate(val, amt int64) {
d := s.delegator()
v := s.validator(val)
msg := stakingtypes.NewMsgUndelegate(d, v, coin)
server.Undelegate(sdk.WrapSDKContext(s.ctx(PROVIDER)), msg)
_, err := server.Undelegate(sdk.WrapSDKContext(s.ctx(PROVIDER)), msg)
if err != nil {
log.Println("error when undelegating (is this expected?): ", err)
}
}

// packetQueue returns the queued packets from sender to receiver,
Expand Down
3 changes: 2 additions & 1 deletion tests/mbt/driver/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,11 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC
NewChain: consumerGenesis.NewChain,
}

s.providerKeeper().SetConsumerGenesis(
err = s.providerKeeper().SetConsumerGenesis(
providerChain.GetContext(),
string(consumerChainId),
consumerGenesisForProvider)
require.NoError(s.t, err, "Error setting consumer genesis on provider for chain %v", consumerChain.ChainID)

// Client ID is set in InitGenesis and we treat it as a black box. So
// must query it to use it with the endpoint.
Expand Down
3 changes: 2 additions & 1 deletion tests/mbt/driver/trace_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type InvariantConfig struct {
// the trace will still be stored in the folder.
func GenerateTraces(numTraces int, modelConfig ModelConfig, invConfig InvariantConfig, traceFolder string) {
// make sure the folder exists
if err := os.MkdirAll(traceFolder, 0o755); err != nil {
if err := os.MkdirAll(traceFolder, 0o750); err != nil {
panic(err)
}

Expand Down Expand Up @@ -62,6 +62,7 @@ func GenerateTrace(modelConfig ModelConfig, invConfig InvariantConfig, traceName

fmt.Println(cmd)

//#nosec G204 -- Bypass linter warning for spawning subprocess with variable.
out, err := exec.Command("bash", "-c", cmd).CombinedOutput()
if err != nil {
if strings.Contains(string(out), "Invariant violated") {
Expand Down
Loading