test updates

Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Casey Lee
2020-02-11 23:55:20 -08:00
parent f7252cbcf9
commit 64562d41ab
11 changed files with 37 additions and 30 deletions

View File

@@ -33,10 +33,10 @@ func TestAddpath(t *testing.T) {
rc := new(RunContext)
handler := rc.commandHandler(ctx)
handler("::add-path::/zoo")
handler("::add-path::/zoo\n")
assert.Equal("/zoo:", rc.Env["PATH"])
handler("::add-path::/booo")
handler("::add-path::/booo\n")
assert.Equal("/booo:/zoo:", rc.Env["PATH"])
}

View File

@@ -128,7 +128,11 @@ func (rc *RunContext) runContainer(containerSpec *model.ContainerSpec) common.Ex
rawLogger := common.Logger(ctx).WithField("raw_output", true)
logWriter := common.NewLineWriter(rc.commandHandler(ctx), func(s string) {
rawLogger.Debugf(s)
if rc.Config.LogOutput {
rawLogger.Infof(s)
} else {
rawLogger.Debugf(s)
}
})
return container.NewDockerRunExecutor(container.NewDockerRunExecutorInput{

View File

@@ -22,6 +22,7 @@ type Config struct {
EventPath string // path to JSON file to use for event.json in containers
ReuseContainers bool // reuse containers to maintain state
ForcePull bool // force pulling of the image, if already present
LogOutput bool // log the output from docker run
}
type runnerImpl struct {

View File

@@ -37,18 +37,15 @@ func TestRunEvent(t *testing.T) {
eventName string
errorMessage string
}{
{"basic", "push", ""},
{"fail", "push", "exit with `FAILURE`: 1"},
{"runs-on", "push", ""},
/*
{"basic", "push", ""},
{"fail", "push", "exit with `FAILURE`: 1"},
{"runs-on", "push", ""},
{"job-container", "push", ""},
{"uses-docker-url", "push", ""},
{"remote-action-docker", "push", ""},
{"remote-action-js", "push", ""},
{"local-action-docker-url", "push", ""},
{"local-action-dockerfile", "push", ""},
*/
{"job-container", "push", ""},
{"uses-docker-url", "push", ""},
{"remote-action-docker", "push", ""},
{"remote-action-js", "push", ""},
{"local-action-docker-url", "push", ""},
{"local-action-dockerfile", "push", ""},
}
log.SetLevel(log.DebugLevel)