2020-06-15 12:46:54 +02:00
// +build integration
// can be execute with go test -tags=integration ./integration/...
package main
import (
"testing"
)
func TestMavenProject ( t * testing . T ) {
t . Parallel ( )
2020-07-20 18:07:08 +02:00
container := givenThisContainer ( t , IntegrationTestDockerExecRunnerBundle {
2021-04-21 14:01:03 +02:00
Image : "devxci/mbtci:1.1.1" ,
2021-03-10 09:12:55 +02:00
User : "root" ,
2020-07-20 18:07:08 +02:00
TestDir : [ ] string { "testdata" , "TestMtaIntegration" , "maven" } ,
2020-06-15 12:46:54 +02:00
} )
2020-07-20 18:07:08 +02:00
err := container . whenRunningPiperCommand ( "mtaBuild" , "--installArtifacts" , "--m2Path=mym2" )
2020-06-15 12:46:54 +02:00
if err != nil {
2020-07-20 18:07:08 +02:00
t . Fatalf ( "Piper command failed %s" , err )
2020-06-15 12:46:54 +02:00
}
2020-07-20 18:07:08 +02:00
container . assertHasOutput ( t , "Installing /project/.flattened-pom.xml to /project/mym2/mygroup/mymvn/1.0-SNAPSHOT/mymvn-1.0-SNAPSHOT.pom" )
container . assertHasOutput ( t , "Installing /project/app/target/mymvn-app-1.0-SNAPSHOT.war to /project/mym2/mygroup/mymvn-app/1.0-SNAPSHOT/mymvn-app-1.0-SNAPSHOT.war" )
container . assertHasOutput ( t , "Installing /project/app/target/mymvn-app-1.0-SNAPSHOT-classes.jar to /project/mym2/mygroup/mymvn-app/1.0-SNAPSHOT/mymvn-app-1.0-SNAPSHOT-classes.jar" )
container . assertHasOutput ( t , "added 2 packages from 3 contributors and audited 2 packages in" )
2020-06-15 12:46:54 +02:00
}
2020-08-06 15:12:21 +02:00
func TestMavenSpringProject ( t * testing . T ) {
t . Parallel ( )
container := givenThisContainer ( t , IntegrationTestDockerExecRunnerBundle {
2021-04-21 14:01:03 +02:00
Image : "devxci/mbtci:1.1.1" ,
2021-03-10 09:12:55 +02:00
User : "root" ,
2020-08-06 15:12:21 +02:00
TestDir : [ ] string { "testdata" , "TestMtaIntegration" , "maven-spring" } ,
} )
err := container . whenRunningPiperCommand ( "mtaBuild" , "--installArtifacts" , "--m2Path=mym2" )
if err != nil {
t . Fatalf ( "Piper command failed %s" , err )
}
err = container . whenRunningPiperCommand ( "mavenExecuteIntegration" , "--m2Path=mym2" )
if err != nil {
t . Fatalf ( "Piper command failed %s" , err )
}
container . assertHasOutput ( t , "Tests run: 1, Failures: 0, Errors: 0, Skipped: 0" )
}
2020-06-15 12:46:54 +02:00
func TestNPMProject ( t * testing . T ) {
t . Parallel ( )
2020-07-20 18:07:08 +02:00
container := givenThisContainer ( t , IntegrationTestDockerExecRunnerBundle {
2021-04-21 14:01:03 +02:00
Image : "devxci/mbtci:1.1.1" ,
2021-03-10 09:12:55 +02:00
User : "root" ,
2020-07-20 18:07:08 +02:00
TestDir : [ ] string { "testdata" , "TestMtaIntegration" , "npm" } ,
2020-06-15 12:46:54 +02:00
} )
2020-07-20 18:07:08 +02:00
err := container . whenRunningPiperCommand ( "mtaBuild" , "" )
2020-06-15 12:46:54 +02:00
if err != nil {
2020-07-20 18:07:08 +02:00
t . Fatalf ( "Piper command failed %s" , err )
2020-06-15 12:46:54 +02:00
}
2020-07-20 18:07:08 +02:00
container . assertHasOutput ( t , "INFO the MTA archive generated at: test-mta-js.mtar" )
2020-06-15 12:46:54 +02:00
}
2020-06-22 10:39:52 +02:00
func TestNPMProjectInstallsDevDependencies ( t * testing . T ) {
t . Parallel ( )
2020-07-20 18:07:08 +02:00
container := givenThisContainer ( t , IntegrationTestDockerExecRunnerBundle {
2021-04-21 14:01:03 +02:00
Image : "devxci/mbtci:1.1.1" ,
2021-03-10 09:12:55 +02:00
User : "root" ,
2020-07-20 18:07:08 +02:00
TestDir : [ ] string { "testdata" , "TestMtaIntegration" , "npm-install-dev-dependencies" } ,
2020-06-22 10:39:52 +02:00
} )
2020-07-20 18:07:08 +02:00
err := container . whenRunningPiperCommand ( "mtaBuild" , "--installArtifacts" )
2020-06-22 10:39:52 +02:00
if err != nil {
2020-07-20 18:07:08 +02:00
t . Fatalf ( "Piper command failed %s" , err )
2020-06-22 10:39:52 +02:00
}
2020-07-20 18:07:08 +02:00
container . assertHasOutput ( t , "added 2 packages in" )
2020-06-22 10:39:52 +02:00
}