Skip to content

Commit c193166

Browse files
committed
Increased further.
1 parent f7e56a5 commit c193166

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

pipeline/build_golang_test.go

+34
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,40 @@ func TestExecuteBuild(t *testing.T) {
9696
}
9797
}
9898

99+
func TestExecuteBuildFailPipelineBuild(t *testing.T) {
100+
os.Mkdir("tmp", 0744)
101+
ioutil.WriteFile(filepath.Join("tmp", "main.go"), []byte(`package main
102+
import "os"
103+
func main() {
104+
os.Exit(1
105+
}`), 0766)
106+
wd, _ := os.Getwd()
107+
tmp := filepath.Join(wd, "tmp")
108+
defer func() {
109+
os.RemoveAll(tmp)
110+
}()
111+
gaia.Cfg = new(gaia.Config)
112+
gaia.Cfg.HomePath = tmp
113+
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
114+
Level: hclog.Trace,
115+
Output: hclog.DefaultOutput,
116+
Name: "Gaia",
117+
})
118+
b := new(BuildPipelineGolang)
119+
p := new(gaia.CreatePipeline)
120+
p.Pipeline.Repo.LocalDest = tmp
121+
err := b.ExecuteBuild(p)
122+
if err == nil {
123+
t.Fatal("error while running executebuild. none was expected")
124+
}
125+
expected := `# _/Users/gbrautigam/gohome/src/github.com/gaia-pipeline/gaia/pipeline/tmp
126+
./main.go:4:13: syntax error: unexpected newline, expecting comma or )
127+
`
128+
if p.Output != expected {
129+
t.Fatal("got a different output than expected: ", p.Output)
130+
}
131+
}
132+
99133
func TestExecuteBuildContextTimeout(t *testing.T) {
100134
execCommandContext = fakeExecCommandContext
101135
killContext = true

0 commit comments

Comments
 (0)