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 HA-pipeline-<branch> |
| 22 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 23 | // read the dependency files |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 24 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' ) |
| 25 | test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' ) |
| 26 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 27 | |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 28 | fileRelated.init() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 29 | |
| 30 | // initialize the funcs with category of HA |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 31 | funcs.initialize( "HA" ); |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 32 | |
| 33 | // This is a Jenkinsfile for a scripted pipeline for the FUNC tests |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 34 | def prop = null |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 35 | |
| 36 | // Read the TestONOS.property from the VM |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 37 | prop = funcs.getProperties() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 38 | |
| 39 | // get the list of the test and init branch to it. |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 40 | HA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "HA" ] |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 41 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 42 | // init some directories |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 43 | graph_generator_file = fileRelated.trendIndividual |
| 44 | graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 45 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 46 | // get the list of the test to run |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 47 | echo( "Testcases:" ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 48 | def testsToRun = null |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 49 | testsToRun = funcs.getTestsToRun( prop[ "Tests" ] ) |
| 50 | funcs.printTestToRun( testsToRun ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 51 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 52 | // run the test sequentially and save the function into the dictionary. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 53 | def tests = [ : ] |
| 54 | for ( String test : HA.keySet() ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 55 | toBeRun = testsToRun.contains( test ) |
| 56 | def stepName = ( toBeRun ? "" : "Not " ) + "Running $test" |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame^] | 57 | def pureTestName = HA[ test ][ "test" ].split().head() |
| 58 | tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false, |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 59 | HA, graph_generator_file, graph_saved_directory ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 62 | // get the start time of the test. |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 63 | start = funcs.getCurrentTime() |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 64 | // run the tests sequentially. |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 65 | for ( test in tests.keySet() ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 66 | tests[ test ].call() |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 67 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 68 | |
| 69 | // generate the overall graph of the HA tests. |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 70 | funcs.generateOverallGraph( prop, HA, graph_saved_directory ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 71 | |
| 72 | // send the notification to Slack that running HA tests was ended. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 73 | funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] ) |