Skip to content

Commit

Permalink
[FAB-13370] increase go env timeout from 10s to 1m
Browse files Browse the repository at this point in the history
kicking the refactor can down the road a bit by simply extending the
timeout and adding a call stack to the error that is returned by
runProgram.

Change-Id: I0b52a87ceaa9f6afd1884024eedeea051545faa1
Signed-off-by: Matthew Sykes <[email protected]>
  • Loading branch information
sykesm authored and Brett Logan committed Nov 17, 2020
1 parent 1d7b876 commit e876e64
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/chaincode/exectransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ func runChaincodeInvokeChaincode(t *testing.T, channel1 string, channel2 string,
if err != nil {
stopChaincode(ctxt, cccid1, chaincodeSupport)
stopChaincode(ctxt, cccid2, chaincodeSupport)
t.Fatalf("Error initializing chaincode %s(%s)", chaincode2Name, err)
t.Fatalf("Error initializing chaincode %s(%+v)", chaincode2Name, err)
return nextBlockNumber1, nextBlockNumber2
}
nextBlockNumber1++
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/golang/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func getEnv() Env {
func getGoEnv() (Env, error) {
env := getEnv()

goenvbytes, err := runProgram(env, 10*time.Second, "go", "env")
goenvbytes, err := runProgram(env, time.Minute, "go", "env")
if err != nil {
return nil, err
}
Expand Down
14 changes: 5 additions & 9 deletions core/chaincode/platforms/golang/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"os/exec"
"strings"
"time"

"github.com/pkg/errors"
)

//runProgram non-nil Env, timeout (typically secs or millisecs), program name and args
Expand All @@ -43,16 +45,10 @@ func runProgram(env Env, timeout time.Duration, pgm string, args ...string) ([]b
if ctx.Err() == context.DeadlineExceeded {
err = fmt.Errorf("timed out after %s", timeout)
}

if err != nil {
return nil,
fmt.Errorf(
"command <%s %s>: failed with error: \"%s\"\n%s",
pgm,
strings.Join(args, " "),
err,
string(stdErr.Bytes()))
return nil, errors.Errorf("command <%s %s>: failed with error: \"%s\"\n%s", pgm, strings.Join(args, " "), err, stdErr)
}

return out, nil
}

Expand All @@ -62,7 +58,7 @@ func list(env Env, template, pkg string) ([]string, error) {
env = getEnv()
}

lst, err := runProgram(env, 60*time.Second, "go", "list", "-f", template, pkg)
lst, err := runProgram(env, time.Minute, "go", "list", "-f", template, pkg)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e876e64

Please sign in to comment.