Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 1 | #!groovy |
| 2 | // Copyright 2018 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 SRHA-pipeline-<branch> |
| 22 | |
| 23 | // read dependencies. |
| 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' ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 26 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' ) |
| 27 | |
| 28 | // init configuration to be SR |
| 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" ) |
| 32 | |
| 33 | // Allow to run with --params-file argument |
| 34 | hasArgs = true |
| 35 | |
| 36 | // get the name of the Jenkins job. |
| 37 | jobName = env.JOB_NAME |
| 38 | |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -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, 2.1 on Fabric3 and 1.15 on Fabric2 ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 41 | def prop = null |
| 42 | prop = funcs.getProperties() |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 43 | SRHA_tests = test_list.getTestsFromCategory( "SRHA" ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 44 | |
| 45 | // set the file paths and directory |
| 46 | graph_generator_file = fileRelated.trendIndividual |
| 47 | graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + "/" |
| 48 | |
| 49 | // get the list of the tests. |
| 50 | echo( "Testcases:" ) |
| 51 | def testsToRun = null |
| 52 | testsToRun = funcs.getTestsToRun( prop[ "Tests" ] ) |
| 53 | funcs.printTestToRun( testsToRun ) |
| 54 | |
| 55 | // save the functions to run test in the dictionary. |
| 56 | def tests = [ : ] |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 57 | for ( String test : SRHA_tests.keySet() ){ |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [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 = ( SRHA_tests[ test ].containsKey( "test" ) ? SRHA_tests[ test ][ "test" ].split().head() : test ) |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -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 | SRHA_tests, graph_generator_file, graph_saved_directory ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | // get start time |
| 66 | start = funcs.getCurrentTime() |
| 67 | |
| 68 | // run the tests sequentially |
| 69 | for ( test in tests.keySet() ){ |
| 70 | tests[ test ].call() |
| 71 | } |
| 72 | //funcs.generateOverallGraph( prop, SR, graph_saved_directory ) |
| 73 | // send the notification of ending test after SRHA tests are done. |
| 74 | funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] ) |