Devin Lim | e1346f4 | 2018-05-15 15:41:36 -0700 | [diff] [blame] | 1 | #!groovy |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 2 | // Copyright 2017 Open Networking Foundation (ONF) |
| 3 | // |
| 4 | // Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | // the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | // or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 7 | // |
| 8 | // TestON is free software: you can redistribute it and/or modify |
| 9 | // it under the terms of the GNU General Public License as published by |
| 10 | // the Free Software Foundation, either version 2 of the License, or |
| 11 | // (at your option) any later version. |
| 12 | // |
| 13 | // TestON is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | // This is the Jenkins script for SR-pipeline-<branch> |
| 22 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 23 | // read dependencies. |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 24 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 25 | test_list = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' ) |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 26 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 27 | |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 28 | // init configuration to be SR |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 29 | fileRelated.init() |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 30 | test_list.init() |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 31 | funcs.initialize( "SR" ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 32 | |
| 33 | // get the name of the Jenkins job. |
Devin Lim | 35df4e6 | 2018-04-06 17:58:58 -0700 | [diff] [blame] | 34 | jobName = env.JOB_NAME |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 35 | |
| 36 | // additional setup for Segment routing because it is running multiple branch concurrently on different machines. |
Devin Lim | c4054d5 | 2018-04-13 18:58:33 -0700 | [diff] [blame] | 37 | funcs.additionalInitForSR( jobName ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 38 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 39 | // read the TestON.property depends on which branch it is running. |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 40 | // ( currently master on Fabric4, 1.15 on Fabric2 and 2.1 on Fabric3 ) |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 41 | def prop = null |
| 42 | prop = funcs.getProperties() |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 43 | SR_tests = test_list.getTestsFromCategory( "SR" ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 44 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 45 | // set the file paths and directory |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 46 | graph_generator_file = fileRelated.trendIndividual |
| 47 | graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/" |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 48 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 49 | // get the list of the tests. |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 50 | echo( "Testcases:" ) |
| 51 | def testsToRun = null |
| 52 | testsToRun = funcs.getTestsToRun( prop[ "Tests" ] ) |
| 53 | funcs.printTestToRun( testsToRun ) |
| 54 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 55 | // save the functions to run test in the dictionary. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 56 | def tests = [ : ] |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 57 | for ( String test : SR_tests.keySet() ){ |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 58 | toBeRun = testsToRun.contains( test ) |
| 59 | def stepName = ( toBeRun ? "" : "Not " ) + "Running $test" |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 60 | def pureTestName = ( SR_tests[ test ].containsKey( "test" ) ? SR_tests[ test ][ "test" ].split().head() : test ) |
Jon Hall | e5da90a | 2018-06-14 12:26:00 -0700 | [diff] [blame] | 61 | tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false, |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 62 | SR_tests, graph_generator_file, graph_saved_directory ) |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 63 | } |
| 64 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 65 | // get start time |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 66 | start = funcs.getCurrentTime() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 67 | |
| 68 | // run the tests sequentially |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 69 | for ( test in tests.keySet() ){ |
| 70 | tests[ test ].call() |
| 71 | } |
| 72 | //funcs.generateOverallGraph( prop, SR, graph_saved_directory ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 73 | // send the notification of ending test after SR tests is done. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 74 | funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] ) |