github.com/nilium/gitlab-runner@v12.5.0+incompatible/helpers/integration_tests.go (about) 1 package helpers 2 3 import ( 4 "os/exec" 5 "testing" 6 ) 7 8 func SkipIntegrationTests(t *testing.T, app ...string) bool { 9 if testing.Short() { 10 t.Skip("Skipping long tests") 11 return true 12 } 13 14 if ok, err := ExecuteCommandSucceeded(app...); !ok { 15 t.Skip(app[0], "failed", err) 16 return true 17 } 18 19 return false 20 } 21 22 // ExecuteCommandSucceeded tests whether a particular command execution successfully 23 // completes. If it does not, it returns the error produced. 24 func ExecuteCommandSucceeded(app ...string) (bool, error) { 25 if len(app) > 0 { 26 cmd := exec.Command(app[0], app[1:]...) 27 err := cmd.Run() 28 if err != nil { 29 return false, err 30 } 31 } 32 return true, nil 33 }