File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,40 @@ func TestExecuteBuild(t *testing.T) {
96
96
}
97
97
}
98
98
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
+
99
133
func TestExecuteBuildContextTimeout (t * testing.T ) {
100
134
execCommandContext = fakeExecCommandContext
101
135
killContext = true
You can’t perform that action at this time.
0 commit comments