ACS-1646 Reduce time to buid AGS jobs in repo projects (#526)

Having added AGS to the community repo project two of the build jobs were take a long time to run in comparison to others:

    AGS Unit & Integration Tests (MySQL) ~ 1hr
    AGS Unit & Integration Tests (PostgreSQL) ~ 45mins

Having split the jobs in this commit, the individual job times are now comparable to the other jobs and the total build time is reduced by ~30 mins.

The same number of integration tests (418) are run 196+127+95 across the three jobs for each database.
This commit is contained in:
Alan Davis
2021-06-10 16:05:15 +01:00
committed by GitHub
parent 98a30df09b
commit 3dd5fecd8f
5 changed files with 229 additions and 11 deletions

View File

@@ -301,13 +301,29 @@ jobs:
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
script: travis_wait 20 mvn -B test -pl :alfresco-share-services -Dtest=ShareServicesTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "AGS Unit & Integration Tests (PostgreSQL)"
- name: "AGS Unit & Integration Tests 01 (PostgreSQL)"
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -f amps/ags/pom.xml ${LOG_WARN}
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -PagsAllTestSuitePt1 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Unit & Integration Tests (MySQL) "
- name: "AGS Integration Tests 02 (PostgreSQL)"
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -PagsAllTestSuitePt2 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Integration Tests 03 (PostgreSQL)"
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -PagsAllTestSuitePt3 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Unit & Integration Tests 01 (MySQL) "
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags on MySQL\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -f amps/ags/pom.xml ${LOG_WARN}
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -PagsAllTestSuitePt1 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Integration Tests 02 (MySQL) "
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags on MySQL\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -PagsAllTestSuitePt2 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Integration Tests 03 (MySQL) "
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags on MySQL\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -PagsAllTestSuitePt3 -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Community Rest API Tests"
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/

View File

@@ -248,7 +248,7 @@
<dir.root>${project.build.directory}/alf-data-test</dir.root>
</systemPropertyVariables>
<includes>
<include>**/AllTestSuite.class</include>
<include>${integrationTestSuite}</include>
</includes>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.directory}/${project.build.finalName}/config</additionalClasspathElement>
@@ -331,6 +331,25 @@
</build>
<profiles>
<profile>
<id>agsAllTestSuitePt1</id>
<properties>
<integrationTestSuite>**/AllTestSuitePt1.class</integrationTestSuite>
</properties>
</profile>
<profile>
<id>agsAllTestSuitePt2</id>
<properties>
<integrationTestSuite>**/AllTestSuitePt2.class</integrationTestSuite>
</properties>
</profile>
<profile>
<id>agsAllTestSuitePt3</id>
<properties>
<integrationTestSuite>**/AllTestSuitePt3.class</integrationTestSuite>
</properties>
</profile>
<profile>
<id>use-mysql</id>
<properties>

View File

@@ -24,7 +24,6 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.module.org_alfresco_module_rm.test;
import org.junit.extensions.cpsuite.ClasspathSuite;
@@ -34,7 +33,7 @@ import org.junit.extensions.cpsuite.SuiteType;
import org.junit.runner.RunWith;
/**
* Convenience test suite that runs all the tests.
* Convenience test suite that runs all the tests. THIS HAS BEEN SPLIT INTO PARTS SO THAT THE BUILD TIME IS REDUCED.
*
* @author Roy Wetherall
* @since 2.1
@@ -42,10 +41,20 @@ import org.junit.runner.RunWith;
@RunWith(ClasspathSuite.class)
@SuiteTypes({SuiteType.TEST_CLASSES, SuiteType.RUN_WITH_CLASSES, SuiteType.JUNIT38_TEST_CLASSES})
@ClassnameFilters({
// Execute all test classes ending with "Test"
".*Test",
// Exclude the ones ending with "UnitTest"
// The following packages are run by Pt1. IF YOU CHANGE THIS LIST ALSO CHANGE IT IN AllTestSuitePt3.
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.action\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.capabilities\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.jscript\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.security\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.service\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.webscript\\..*Test",
// There appears to be some common setup taking place in the first 2 packages, which is why all legacy tests are
// together even though they take a little longer to run that way.
// Exclude all UnitTests
"!.*UnitTest",
// Put the test classes you want to exclude here
"!.*DataLoadSystemTest",
"!.*RM2072Test",
@@ -63,6 +72,6 @@ import org.junit.runner.RunWith;
// Tests should not be dependant on other test classes and should run in any order without any problems.
"!.*EmailMapScriptTest"
})
public class AllTestSuite
public class AllTestSuitePt1
{
}

View File

@@ -0,0 +1,75 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.module.org_alfresco_module_rm.test;
import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters;
import org.junit.extensions.cpsuite.ClasspathSuite.SuiteTypes;
import org.junit.extensions.cpsuite.SuiteType;
import org.junit.runner.RunWith;
/**
* Convenience test suite that runs all the tests. THIS HAS BEEN SPLIT INTO PARTS SO THAT THE BUILD TIME IS REDUCED.
*
* @author Roy Wetherall
* @since 2.1
*/
@RunWith(ClasspathSuite.class)
@SuiteTypes({SuiteType.TEST_CLASSES, SuiteType.RUN_WITH_CLASSES, SuiteType.JUNIT38_TEST_CLASSES})
@ClassnameFilters({
// The following packages are run by Pt2. IF YOU CHANGE THIS LIST ALSO CHANGE IT IN AllTestSuitePt3.
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.destroy\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.disposition\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.dod\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.event\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.hold\\..*Test",
"org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.issue\\..*Test",
// Exclude all UnitTests
"!.*UnitTest",
// Put the test classes you want to exclude here
"!.*DataLoadSystemTest",
"!.*RM2072Test",
"!.*RM2190Test",
"!.*RM981SystemTest",
"!.*RM3993Test",
"!.*RM4163Test",
"!.*RecordsManagementEventServiceImplTest",
"!.*RmRestApiTest",
"!.*NotificationServiceHelperSystemTest",
"!.*RetryingTransactionHelperBaseTest",
"!.*RMCaveatConfigServiceImplTest",
// This test is running successfully locally but not on bamboo (if executed as a single test).
// The problem can be reproduced if the whole test suite is run locally as well.
// Tests should not be dependant on other test classes and should run in any order without any problems.
"!.*EmailMapScriptTest"
})
public class AllTestSuitePt2
{
}

View File

@@ -0,0 +1,99 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.module.org_alfresco_module_rm.test;
import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters;
import org.junit.extensions.cpsuite.ClasspathSuite.SuiteTypes;
import org.junit.extensions.cpsuite.SuiteType;
import org.junit.runner.RunWith;
/**
* Convenience test suite that runs all the tests. THIS HAS BEEN SPLIT INTO PARTS SO THAT THE BUILD TIME IS REDUCED.
*
* @author Roy Wetherall
* @since 2.1
*/
@RunWith(ClasspathSuite.class)
@SuiteTypes({SuiteType.TEST_CLASSES, SuiteType.RUN_WITH_CLASSES, SuiteType.JUNIT38_TEST_CLASSES})
@ClassnameFilters({
// Use a catch all for tests and then exclude those in other parts in case someone forgets to add a package.
".*Test",
// The following packages are run by Pt1
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.action\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.capabilities\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.jscript\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.security\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.service\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.legacy\\.webscript\\..*Test",
// The following packages are run by Pt2
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.destroy\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.disposition\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.dod\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.event\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.hold\\..*Test",
"!org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.issue\\..*Test",
// The following packages 'should' be run by Pt3
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.issue\\.rm3314\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.record\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.recordfolder\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.relationship\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.report\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.rule\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.transfer\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.integration\\.version\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.system\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.util\\..*Test",
// "org\\.alfresco\\.module\\.org_alfresco_module_rm\\.test\\.util\\.bdt\\..*Test",
// Exclude all UnitTests
"!.*UnitTest",
// Put the test classes you want to exclude here
"!.*DataLoadSystemTest",
"!.*RM2072Test",
"!.*RM2190Test",
"!.*RM981SystemTest",
"!.*RM3993Test",
"!.*RM4163Test",
"!.*RecordsManagementEventServiceImplTest",
"!.*RmRestApiTest",
"!.*NotificationServiceHelperSystemTest",
"!.*RetryingTransactionHelperBaseTest",
"!.*RMCaveatConfigServiceImplTest",
// This test is running successfully locally but not on bamboo (if executed as a single test).
// The problem can be reproduced if the whole test suite is run locally as well.
// Tests should not be dependant on other test classes and should run in any order without any problems.
"!.*EmailMapScriptTest"
})
public class AllTestSuitePt3
{
}