1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/integration/integration_test.go

34 lines
756 B
Go

// +build integration
// can be execute with go test -tags=integration ./integration/...
package main
import (
"bytes"
"os"
"testing"
"github.com/SAP/jenkins-library/pkg/command"
"github.com/stretchr/testify/assert"
)
func TestPiperHelp(t *testing.T) {
t.Parallel()
piperHelpCmd := command.Command{}
var commandOutput bytes.Buffer
piperHelpCmd.Stdout(&commandOutput)
err := piperHelpCmd.RunExecutable(getPiperExecutable(), "--help")
assert.NoError(t, err, "Calling piper --help failed")
assert.Contains(t, commandOutput.String(), "Use \"piper [command] --help\" for more information about a command.")
}
func getPiperExecutable() string {
if p := os.Getenv("PIPER_INTEGRATION_EXECUTABLE"); len(p) > 0 {
return p
}
return "piper"
}