Lint fix integration tests

This commit is contained in:
Kristoffer Dalby
2021-11-14 18:35:49 +01:00
parent 85f28a3f4a
commit ba084b9987
3 changed files with 13 additions and 6 deletions

View File

@@ -12,6 +12,8 @@ import (
"github.com/ory/dockertest/v3/docker"
)
const DOCKER_EXECUTE_TIMEOUT = 10 * time.Second
func ExecuteCommand(
resource *dockertest.Resource,
cmd []string,
@@ -21,7 +23,7 @@ func ExecuteCommand(
var stderr bytes.Buffer
// TODO(kradalby): Make configurable
timeout := 10 * time.Second
timeout := DOCKER_EXECUTE_TIMEOUT
type result struct {
exitCode int
@@ -55,11 +57,13 @@ func ExecuteCommand(
fmt.Println("Command: ", cmd)
fmt.Println("stdout: ", stdout.String())
fmt.Println("stderr: ", stderr.String())
return "", fmt.Errorf("command failed with: %s", stderr.String())
}
return stdout.String(), nil
case <-time.After(timeout):
return "", fmt.Errorf("command timed out after %s", timeout)
}
}