1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-30 05:59:39 +02:00
sap-jenkins-library/integration/integration_maven_build_test.go

48 lines
1.5 KiB
Go

// +build integration
// can be execute with go test -tags=integration ./integration/...
package main
import (
"testing"
)
func TestMavenBuildCloudSdkSpringProject(t *testing.T) {
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
Image: "maven:3-openjdk-8-slim",
User: "1000",
TestDir: []string{"testdata", "TestMavenIntegration", "cloud-sdk-spring-archetype"},
Mounts: map[string]string{},
Setup: []string{},
})
err := container.whenRunningPiperCommand("mavenBuild", "")
if err != nil {
t.Fatalf("Calling piper command filed %s", err)
}
container.assertHasOutput(t, "BUILD SUCCESS")
container.assertHasFile(t, "/project/application/target/cloud-sdk-spring-archetype-application.jar")
container.assertHasFile(t, "/tmp/.m2/repository")
}
func TestMavenBuildCloudSdkTomeeProject(t *testing.T) {
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
Image: "maven:3-openjdk-8-slim",
User: "1000",
TestDir: []string{"testdata", "TestMavenIntegration", "cloud-sdk-tomee-archetype"},
Mounts: map[string]string{},
Setup: []string{},
})
err := container.whenRunningPiperCommand("mavenBuild", "")
if err != nil {
t.Fatalf("Calling piper command filed %s", err)
}
container.assertHasOutput(t, "BUILD SUCCESS")
container.assertHasFile(t, "/project/application/target/cloud-sdk-tomee-archetype-application-classes.jar")
container.assertHasFile(t, "/project/application/target/cloud-sdk-tomee-archetype-application.war")
container.assertHasFile(t, "/tmp/.m2/repository")
}