[ONOS-7994]: Combine TestON Pipeline Scripts Containing Similar Code
Change-Id: I1727233b87ca957c8e23c6c839232b22121847dd
diff --git a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
index f57fefb..be93b7f 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
@@ -114,18 +114,13 @@
}
}
-def printType(){
- // print the test type and test machine that was initialized.
-
- echo testType
- echo testMachine
-}
-
-def getProperties( category ){
+def getProperties( category, branchWithPrefix ){
// get the properties of the test by reading the TestONOS.property
+ filePath = '''/var/jenkins/TestONOS-''' + category + '''-''' + branchWithPrefix + '''.property'''
+
node( testMachine ) {
- return readProperties( file: '/var/jenkins/TestONOS-' + category + '.property' )
+ return readProperties( file: filePath )
}
}
@@ -142,20 +137,6 @@
return new Date()
}
-def getTotalTime( start, end ){
- // get total time of the test using start and end time.
-
- return TimeCategory.minus( end, start )
-}
-
-def printTestToRun( testList ){
- // printout the list of the test in the list.
-
- for ( String test : testList ){
- println test
- }
-}
-
def sendResultToSlack( start, isManualRun, branch ){
// send the result of the test to the slack when it is not manually running.
// start : start time of the test
@@ -334,7 +315,6 @@
node( testMachine ) {
def alarmFile = workSpace + "/" + pureTestName + "Alarm.txt"
if ( fileExists( alarmFile ) ) {
- print "Abnormal test result logged"
def alarmContents = readFile( alarmFile )
slackSend( channel: getSlackChannel(),
color: "FF0000",
@@ -348,10 +328,10 @@
( resultURL != "" ? ( "\n[Karaf log] : \n" +
resultURL + "artifact/" ) : "" ),
teamDomain: 'onosproject' )
- Failed
+ throw new Exception( "Abnormal test result." )
}
else {
- print "Test results are normal"
+ print "Test results are normal."
}
}
}
@@ -573,27 +553,4 @@
"ALL", onos_branch, testListParam, graph_saved_directory, pieTestListParam )
}
-def branchWithPrefix( branch ){
- // get the branch with the prefix ( "onos-" )
- return ( ( branch != "master" ) ? "onos-" : "" ) + branch
-}
-
-def testBranchWithPrefix( branch ){
- // get TestON branch with the prefix ( "onos-" )
- if ( branch == "1.12" )
- return "onos-1.13"
- else if ( branch == "1.13" )
- return "onos-1.13"
- else if ( branch == "1.14" )
- return "onos-1.15"
- else if ( branch == "1.15" )
- return "onos-1.15"
- else if ( branch == "2.0" )
- return "onos-2.0"
- else if ( branch == "2.1" )
- return "onos-2.1"
- else
- return "master"
-}
-
return this