2020-07-21 11:15:46 +02:00
|
|
|
// +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")
|
2020-07-29 19:51:27 +02:00
|
|
|
|
|
|
|
err = container.whenRunningPiperCommand("mavenExecuteIntegration", "")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Calling piper command filed %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
container.assertHasOutput(t, "INFO mydemo.HelloWorldControllerTest - Starting HelloWorldControllerTest")
|
|
|
|
container.assertHasOutput(t, "Tests run: 1, Failures: 0, Errors: 0, Skipped: 0")
|
|
|
|
|
|
|
|
container.assertHasFile(t, "/project/integration-tests/target/coverage-reports/jacoco.exec")
|
2020-07-21 11:15:46 +02:00
|
|
|
}
|
2020-07-23 09:20:11 +02:00
|
|
|
|
|
|
|
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")
|
2020-07-29 19:51:27 +02:00
|
|
|
|
|
|
|
err = container.whenRunningPiperCommand("mavenExecuteIntegration", "")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Calling piper command filed %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
container.assertHasOutput(t, "(prepare-agent) @ cloud-sdk-tomee-archetype-integration-tests")
|
|
|
|
container.assertHasOutput(t, "Tests run: 1, Failures: 0, Errors: 0, Skipped: 0")
|
|
|
|
|
|
|
|
container.assertHasFile(t, "/project/integration-tests/target/coverage-reports/jacoco.exec")
|
2020-07-23 09:20:11 +02:00
|
|
|
}
|