diff --git a/inabox/bin.sh b/inabox/bin.sh index e77bc581e..a77d568bc 100755 --- a/inabox/bin.sh +++ b/inabox/bin.sh @@ -263,6 +263,11 @@ function start_graph { popd ./wait-for http://0.0.0.0:8000 -- echo "GraphQL up" + if [ $? -ne 0 ]; then + echo "Failed to start graph node" + exit 1 + fi + echo "Graph node started ....." } diff --git a/inabox/deploy/deploy.go b/inabox/deploy/deploy.go index 516d6748f..fbc571a2b 100644 --- a/inabox/deploy/deploy.go +++ b/inabox/deploy/deploy.go @@ -329,7 +329,7 @@ func (env *Config) RegisterBlobVersionAndRelays(ethClient common.EthClient) map[ // TODO: Supply the test path to the runner utility func (env *Config) StartBinaries() { changeDirectory(filepath.Join(env.rootPath, "inabox")) - err := execCmd("./bin.sh", []string{"start-detached"}, []string{}) + err := execCmd("./bin.sh", []string{"start-detached"}, []string{}, true) if err != nil { log.Panicf("Failed to start binaries. Err: %s", err) @@ -339,7 +339,7 @@ func (env *Config) StartBinaries() { // TODO: Supply the test path to the runner utility func (env *Config) StopBinaries() { changeDirectory(filepath.Join(env.rootPath, "inabox")) - err := execCmd("./bin.sh", []string{"stop"}, []string{}) + err := execCmd("./bin.sh", []string{"stop"}, []string{}, true) if err != nil { log.Panicf("Failed to stop binaries. Err: %s", err) } @@ -347,7 +347,7 @@ func (env *Config) StopBinaries() { func (env *Config) StartAnvil() { changeDirectory(filepath.Join(env.rootPath, "inabox")) - err := execCmd("./bin.sh", []string{"start-anvil"}, []string{}) + err := execCmd("./bin.sh", []string{"start-anvil"}, []string{}, false) // printing output causes hang if err != nil { log.Panicf("Failed to start anvil. Err: %s", err) } @@ -355,7 +355,7 @@ func (env *Config) StartAnvil() { func (env *Config) StopAnvil() { changeDirectory(filepath.Join(env.rootPath, "inabox")) - err := execCmd("./bin.sh", []string{"stop-anvil"}, []string{}) + err := execCmd("./bin.sh", []string{"stop-anvil"}, []string{}, true) if err != nil { log.Panicf("Failed to stop anvil. Err: %s", err) } @@ -381,7 +381,7 @@ func (env *Config) RunNodePluginBinary(operation string, operator OperatorVars) "NODE_NUM_CONFIRMATIONS=0", } - err := execCmd("./node-plugin.sh", []string{}, envVars) + err := execCmd("./node-plugin.sh", []string{}, envVars, true) if err != nil { log.Panicf("Failed to run node plugin. Err: %s", err) diff --git a/inabox/deploy/localstack.go b/inabox/deploy/localstack.go index 040029ceb..c0291644c 100644 --- a/inabox/deploy/localstack.go +++ b/inabox/deploy/localstack.go @@ -113,7 +113,11 @@ func DeployResources( changeDirectory(filepath.Join(rootPath, "inabox")) if err := pool.Retry(func() error { fmt.Println("Creating S3 bucket") - return execCmd("./create-s3-bucket.sh", []string{}, []string{fmt.Sprintf("AWS_URL=http://0.0.0.0:%s", localStackPort)}) + return execCmd( + "./create-s3-bucket.sh", + []string{}, + []string{fmt.Sprintf("AWS_URL=http://0.0.0.0:%s", localStackPort)}, + true) }); err != nil { fmt.Println("Could not connect to docker:", err) return err diff --git a/inabox/deploy/subgraph.go b/inabox/deploy/subgraph.go index bcc5a4102..077aa02a5 100644 --- a/inabox/deploy/subgraph.go +++ b/inabox/deploy/subgraph.go @@ -181,7 +181,7 @@ func (env *Config) updateSubgraph(updater subgraphUpdater, path string, startBlo func (env *Config) StartGraphNode() { changeDirectory(filepath.Join(env.rootPath, "inabox")) - err := execCmd("./bin.sh", []string{"start-graph"}, []string{}) + err := execCmd("./bin.sh", []string{"start-graph"}, []string{}, true) if err != nil { log.Panicf("Failed to start graph node. Err: %s", err) } @@ -189,7 +189,7 @@ func (env *Config) StartGraphNode() { func (env *Config) StopGraphNode() { changeDirectory(filepath.Join(env.rootPath, "inabox")) - err := execCmd("./bin.sh", []string{"stop-graph"}, []string{}) + err := execCmd("./bin.sh", []string{"stop-graph"}, []string{}, true) if err != nil { log.Panicf("Failed to stop graph node. Err: %s", err) } diff --git a/inabox/deploy/utils.go b/inabox/deploy/utils.go index f83dc2232..3e9e69355 100644 --- a/inabox/deploy/utils.go +++ b/inabox/deploy/utils.go @@ -276,7 +276,7 @@ func CreateNewTestDirectory(templateName, rootPath string) (string, error) { templatePath := filepath.Join(rootPath, fmt.Sprintf("inabox/templates/%s", templateName)) err = execCmd( "cp", - []string{templatePath, fmt.Sprintf("%s/config.yaml", testPath)}, []string{}) + []string{templatePath, fmt.Sprintf("%s/config.yaml", testPath)}, []string{}, true) if err != nil { return "", fmt.Errorf("failed to copy template to test directory: %s", err.Error()) } @@ -297,7 +297,7 @@ func GetLatestTestDirectory(rootPath string) (string, error) { return testname, nil } -func execCmd(name string, args []string, envVars []string) error { +func execCmd(name string, args []string, envVars []string, print bool) error { cmd := exec.Command(name, args...) if len(envVars) > 0 { cmd.Env = os.Environ() @@ -305,9 +305,10 @@ func execCmd(name string, args []string, envVars []string) error { } var out bytes.Buffer var stderr bytes.Buffer - // TODO: When these are uncommented, the deployer sometimes fails to start anvil - // cmd.Stdout = &out - // cmd.Stderr = &stderr + if print { + cmd.Stdout = &out + cmd.Stderr = &stderr + } err := cmd.Run() if err != nil {