Refactor MO Run System Test Script
Change-Id: I21b2d1852acf3e07433307aed0616bf848d5fb72
diff --git a/TestON/JenkinsFile/MOJenkinsFile.groovy b/TestON/JenkinsFile/MOJenkinsFile.groovy
index d7add2d..01600c0 100644
--- a/TestON/JenkinsFile/MOJenkinsFile.groovy
+++ b/TestON/JenkinsFile/MOJenkinsFile.groovy
@@ -104,18 +104,61 @@
}
}
+// Set of setps to execute before the micro-onos test is run
+def prepareRunningTest(){
+ return '''. ~/.profile
+ cd ~/onos-test
+ make clean
+ '''
+}
+
+// TODO: currently this step is hardcoded to run `make` commands.
+def runMicroOnosTest( run ){
+ return '''make ''' + run + '''
+ '''
+}
+
+def cleanupTest(){
+ return '''. ~/.profile
+ cd ~/onos-test
+ make clean
+ '''
+}
+
+def analyzeResult( didTestFail, didCleanupFail ){
+ if ( didTestFail ){
+ echo "Abnormal Test Result."
+ throw new Exception( "Abnormal Test Result." )
+ } else if ( didCleanupFail ){
+ echo "Cleanup Failure."
+ throw new Exception( "Cleanup Failure." )
+ } else {
+ echo "Test results are OK."
+ }
+}
+
def runMOtest( test, toBeRun ){
return {
catchError {
stage( test ){
if ( toBeRun ){
+ didTestFail = true
+ didCleanupFail = true
node( testStation ) {
- sh script: '''. ~/.profile
- cd ~/onos-test
- make clean
- make integration
- ''', label: "make integration"
+ catchError{
+ run = test.toLowerCase() - "momake"
+ sh script: prepareRunningTest() +
+ runMicroOnosTest( test ), label: "Prepare and Run: make " + run
+ didTestFail = false
+ }
+ catchError{
+ sh script: cleanupTest(), label: "Clean Up Test"
+ didCleanupFail = false
+ }
}
+ analyzeResult( didTestFail, didCleanupFail )
+ } else {
+ echo test + " is not being run today. Leaving the rest of stage contents blank."
}
}
}
diff --git a/TestON/JenkinsFile/dependencies/tests.json b/TestON/JenkinsFile/dependencies/tests.json
index f23c026..14720ad 100644
--- a/TestON/JenkinsFile/dependencies/tests.json
+++ b/TestON/JenkinsFile/dependencies/tests.json
@@ -1449,6 +1449,18 @@
"category": "USECASE",
"supportedBranches": [ "all" ]
},
+ "MOmakeBuild": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
"MOmakeIntegration": {
"wikiName": "Micro ONOS Integration Tests",
"schedules" : [
@@ -1460,5 +1472,101 @@
],
"category": "MO",
"supportedBranches": [ "all" ]
+ },
+ "MOmakeCoverage": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeDeps": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeImages": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeKind": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeLicense_check": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeLinters": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeONOS-Test-Runner-Docker": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
+ },
+ "MOmakeTest": {
+ "wikiName": "Micro ONOS Integration Tests",
+ "schedules" : [
+ {
+ "branch": "master",
+ "day": "everyday",
+ "nodeLabel": "micro-onos"
+ }
+ ],
+ "category": "MO",
+ "supportedBranches": [ "all" ]
}
}