blob: 9549ebff7840fac14913c5489cf723e12916ef60 [file] [log] [blame]
Jon Hall2ee92f82018-06-07 13:07:33 -07001#!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.
24funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
25test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
26fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
27
28// init configuration to be SR
29fileRelated.init()
30funcs.initialize( "SR" )
31
32// Allow to run with --params-file argument
33hasArgs = true
34
35// get the name of the Jenkins job.
36jobName = env.JOB_NAME
37
Jon Hall2ee92f82018-06-07 13:07:33 -070038// read the TestON.property depends on which branch it is running.
You Wangf043d0a2019-04-22 16:30:40 -070039// ( currently master on Fabric4, 2.1 on Fabric3 and 1.15 on Fabric2 )
Jon Hall2ee92f82018-06-07 13:07:33 -070040def prop = null
41prop = funcs.getProperties()
42SRHA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SRHA" ]
43
44// set the file paths and directory
45graph_generator_file = fileRelated.trendIndividual
46graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + "/"
47
48// get the list of the tests.
49echo( "Testcases:" )
50def testsToRun = null
51testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
52funcs.printTestToRun( testsToRun )
53
54// save the functions to run test in the dictionary.
55def tests = [ : ]
56for ( String test : SRHA.keySet() ){
57 toBeRun = testsToRun.contains( test )
58 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
Jon Hall845f5922018-06-14 12:34:42 -070059 def pureTestName = ( SRHA[ test ].containsKey( "test" ) ? SRHA[ test ][ "test" ].split().head() : test )
Jon Hall8b1e92c2018-06-13 14:07:22 -070060 tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false,
61 SRHA, graph_generator_file, graph_saved_directory )
Jon Hall2ee92f82018-06-07 13:07:33 -070062}
63
64// get start time
65start = funcs.getCurrentTime()
66
67// run the tests sequentially
68for ( test in tests.keySet() ){
69 tests[ test ].call()
70}
71//funcs.generateOverallGraph( prop, SR, graph_saved_directory )
72// send the notification of ending test after SRHA tests are done.
73funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )