Skip to content

Commit

Permalink
Increased further.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skarlso committed Jul 10, 2018
1 parent f7e56a5 commit c193166
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pipeline/build_golang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,40 @@ func TestExecuteBuild(t *testing.T) {
}
}

func TestExecuteBuildFailPipelineBuild(t *testing.T) {
os.Mkdir("tmp", 0744)
ioutil.WriteFile(filepath.Join("tmp", "main.go"), []byte(`package main
import "os"
func main() {
os.Exit(1
}`), 0766)
wd, _ := os.Getwd()
tmp := filepath.Join(wd, "tmp")
defer func() {
os.RemoveAll(tmp)
}()
gaia.Cfg = new(gaia.Config)
gaia.Cfg.HomePath = tmp
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
Level: hclog.Trace,
Output: hclog.DefaultOutput,
Name: "Gaia",
})
b := new(BuildPipelineGolang)
p := new(gaia.CreatePipeline)
p.Pipeline.Repo.LocalDest = tmp
err := b.ExecuteBuild(p)
if err == nil {
t.Fatal("error while running executebuild. none was expected")
}
expected := `# _/Users/gbrautigam/gohome/src/github.com/gaia-pipeline/gaia/pipeline/tmp
./main.go:4:13: syntax error: unexpected newline, expecting comma or )
`
if p.Output != expected {
t.Fatal("got a different output than expected: ", p.Output)
}
}

func TestExecuteBuildContextTimeout(t *testing.T) {
execCommandContext = fakeExecCommandContext
killContext = true
Expand Down

0 comments on commit c193166

Please sign in to comment.