blob: 80cda37ed69ab68e070c5229a5dbb177a24b1311 [file] [log] [blame]
Devin Lim90803a82017-08-29 13:41:44 -07001#!groovy
Devin Lim61643762017-12-07 15:55:38 -08002
Devin Lim81ab48b2018-02-09 14:24:57 -08003funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -08004test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
Devin Lim431408d2018-03-23 17:51:31 -07005triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -08006
Devin Lim61643762017-12-07 15:55:38 -08007previous_version = "1.12"
Devin Lim3fa96a92018-03-16 11:47:58 -07008before_previous_version = "1.11"
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -08009funcs.initializeTrend( "VM" );
Devin Lim431408d2018-03-23 17:51:31 -070010triggerFuncs.init( funcs )
Devin Lime89761a2018-03-16 17:52:57 -070011wikiContents = ""
Devin Lim90803a82017-08-29 13:41:44 -070012testcases = [
Devin Lime89761a2018-03-16 17:52:57 -070013 "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
14 "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
15 "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
Devin Lim431408d2018-03-23 17:51:31 -070016 "SR" : [ tests : "", nodeName : "Fabric", wikiContent : "" ],
Devin Lime89761a2018-03-16 17:52:57 -070017 "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
Devin Lim90803a82017-08-29 13:41:44 -070018]
19Prefix_organizer = [
20 "FU" : "FUNC",
21 "HA" : "HA",
22 "PL" : "USECASE",
23 "SA" : "USECASE",
24 "SC" : "SCPF",
Devin Lim61643762017-12-07 15:55:38 -080025 "SR" : "SR",
Devin Lim90803a82017-08-29 13:41:44 -070026 "US" : "USECASE",
27 "VP" : "USECASE"
28]
29
Jeremy Ronquillocdd177d2018-03-09 16:55:44 -080030manually_run = params.manual_run
Devin Lim61643762017-12-07 15:55:38 -080031onos_b = "master"
Devin Lim0e967162017-11-03 15:59:53 -070032test_branch = ""
Devin Lima0e52eb2017-09-13 18:35:12 -070033onos_tag = params.ONOSTag
Devin Lim61643762017-12-07 15:55:38 -080034isOldFlow = true
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080035
Devin Lim90803a82017-08-29 13:41:44 -070036// Set tests based on day of week
Devin Limd1fb8e92018-02-28 16:29:33 -080037def now = funcs.getCurrentTime()
38print now.toString()
Devin Lim61643762017-12-07 15:55:38 -080039today = now[ Calendar.DAY_OF_WEEK ]
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080040
Jeremy Ronquillocdd177d2018-03-09 16:55:44 -080041if ( manually_run ){
42 onos_b = params.ONOSVersion
43} else {
44 if ( today == Calendar.SATURDAY ){
45 onos_b = previous_version
46 } else if( today == Calendar.SUNDAY ){
47 onos_b = before_previous_version
48 }
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080049}
50AllTheTests = test_lists.getAllTheTests( onos_b )
51
Devin Lim90803a82017-08-29 13:41:44 -070052day = ""
Devin Lim61657e42017-10-09 17:24:40 -070053SCPF_choices = ""
Devin Lim90803a82017-08-29 13:41:44 -070054USECASE_choices = ""
Devin Lim61657e42017-10-09 17:24:40 -070055FUNC_choices = ""
56HA_choices = ""
Devin Lim61643762017-12-07 15:55:38 -080057SR_choices = ""
58stat_graph_generator_file = "testCategoryBuildStats.R"
59pie_graph_generator_file = "testCategoryPiePassFail.R"
60graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
Devin Lim90803a82017-08-29 13:41:44 -070061
Devin Lim90803a82017-08-29 13:41:44 -070062post_result = params.PostResult
Devin Lim61657e42017-10-09 17:24:40 -070063if( !manually_run ){
Devin Lim61643762017-12-07 15:55:38 -080064 slackSend( color:'#03CD9F',
65 message:":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n"
66 + "Starting tests on : " + now.toString()
67 + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
Devin Lim61657e42017-10-09 17:24:40 -070068 testDivider( today )
Devin Lim431408d2018-03-23 17:51:31 -070069 FUNC_choices = triggerFuncs.lastCommaRemover( FUNC_choices )
70 HA_choices = triggerFuncs.lastCommaRemover( HA_choices )
71 SCPF_choices = triggerFuncs.lastCommaRemover( SCPF_choices )
72 USECASE_choices = triggerFuncs.lastCommaRemover( USECASE_choices )
73 SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
Devin Lim61657e42017-10-09 17:24:40 -070074}
75
Devin Lim90803a82017-08-29 13:41:44 -070076if ( manually_run ){
Devin Lim431408d2018-03-23 17:51:31 -070077 testcases = triggerFuncs.organize_tests( params.Tests, testcases )
Jeremy Ronquillocdd177d2018-03-09 16:55:44 -080078
Devin Lim0e967162017-11-03 15:59:53 -070079 isOldFlow = params.isOldFlow
Devin Lim90803a82017-08-29 13:41:44 -070080 println "Tests to be run manually : "
81}else{
Devin Lim61643762017-12-07 15:55:38 -080082 testcases[ "SCPF" ][ "tests" ] = SCPF_choices
83 testcases[ "USECASE" ][ "tests" ] = USECASE_choices
84 testcases[ "FUNC" ][ "tests" ] = FUNC_choices
85 testcases[ "HA" ][ "tests" ] = HA_choices
86 testcases[ "SR" ][ "tests" ] = SR_choices
Devin Lim90803a82017-08-29 13:41:44 -070087 println "Defaulting to " + day + " tests:"
88}
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080089
Devin Lim431408d2018-03-23 17:51:31 -070090triggerFuncs.print_tests( testcases )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080091
Devin Lim37a83792017-10-26 16:38:21 -070092def runTest = [
93 "VM" : [:],
94 "BM" : [:]
95]
96for( String test in testcases.keySet() ){
97 println test
Devin Lim61643762017-12-07 15:55:38 -080098 if ( testcases[ test ][ "tests" ] != "" ){
Devin Lim431408d2018-03-23 17:51:31 -070099 runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag )
Devin Lim37a83792017-10-26 16:38:21 -0700100 }
101}
102def finalList = [:]
Devin Lim431408d2018-03-23 17:51:31 -0700103finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] )
104finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] )
Devin Lim37a83792017-10-26 16:38:21 -0700105parallel finalList
Devin Lim61643762017-12-07 15:55:38 -0800106//finalList[ "BM" ].call()
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -0800107
108if ( !manually_run ){
Jeremy Ronquillof78a6ca2018-03-12 09:20:57 -0700109 funcs.generateStatGraph( funcs.branchWithPrefix( onos_b ),
110 AllTheTests,
111 stat_graph_generator_file,
112 pie_graph_generator_file,
113 graph_saved_directory )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -0800114}
Devin Lim90803a82017-08-29 13:41:44 -0700115
Devin Lim61657e42017-10-09 17:24:40 -0700116def testDivider( today ){
Devin Lim61643762017-12-07 15:55:38 -0800117 switch ( today ) {
Devin Lim61657e42017-10-09 17:24:40 -0700118 case Calendar.MONDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700119 initHtmlForWiki()
Devin Lim61657e42017-10-09 17:24:40 -0700120 monday( true )
121 tuesday( true, false )
122 wednesday( true, false )
123 thursday( true, false )
124 friday( true, false )
Devin Lime89761a2018-03-16 17:52:57 -0700125 saturday( false, false )
126 sunday( false, false )
Devin Lim61657e42017-10-09 17:24:40 -0700127 day = "Monday"
Devin Lime89761a2018-03-16 17:52:57 -0700128 closeHtmlForWiki()
129 postToWiki( wikiContents )
Devin Lim61643762017-12-07 15:55:38 -0800130 slackSend( color:'#FFD988', message:"Tests to be run this weekdays : \n" + printDaysForTest() )
Devin Lim61657e42017-10-09 17:24:40 -0700131 break
132 case Calendar.TUESDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700133 tuesday( false, true )
Devin Lim61657e42017-10-09 17:24:40 -0700134 day = "Tuesday"
135 break
136 case Calendar.WEDNESDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700137 wednesday( false, true )
Devin Lim61657e42017-10-09 17:24:40 -0700138 day = "Wednesday"
139 break
140 case Calendar.THURSDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700141 thursday( false, true )
Devin Lim61657e42017-10-09 17:24:40 -0700142 day = "Thursday"
143 break
144 case Calendar.FRIDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700145 friday( false, true )
Devin Lim61657e42017-10-09 17:24:40 -0700146 day = "Friday"
147 break
148 case Calendar.SATURDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700149 saturday( false, true )
Devin Lim61657e42017-10-09 17:24:40 -0700150 day = "Saturday"
151 break
152 case Calendar.SUNDAY:
Devin Lime89761a2018-03-16 17:52:57 -0700153 sunday( false , true )
Devin Lim61657e42017-10-09 17:24:40 -0700154 day = "Sunday"
Devin Lim3fa96a92018-03-16 11:47:58 -0700155 isOldFlow = false
Devin Lim61657e42017-10-09 17:24:40 -0700156 break
157 }
158}
Devin Lim61657e42017-10-09 17:24:40 -0700159def monday( getResult ){
Devin Lime89761a2018-03-16 17:52:57 -0700160 addingHeader( "FUNC" )
Devin Lim61657e42017-10-09 17:24:40 -0700161 FUNC_choices += adder( "FUNC", "basic", true, "M", getResult )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800162 FUNC_choices += adder( "FUNC", "new_Test", true, "M", getResult )
Devin Lim61657e42017-10-09 17:24:40 -0700163 FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700164 closingHeader( "FUNC" )
165 addingHeader( "HA" )
Devin Lim61657e42017-10-09 17:24:40 -0700166 HA_choices += adder( "HA", "basic", true, "M", getResult )
167 HA_choices += adder( "HA", "extra_A", true, "M", getResult )
Devin Lim61643762017-12-07 15:55:38 -0800168 //HA_choices += adder( "HA", "new_Test", true, "M", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700169 closingHeader( "HA" )
170 addingHeader( "SCPF" )
Devin Lim61657e42017-10-09 17:24:40 -0700171 SCPF_choices += adder( "SCPF", "basic", true, "M", getResult )
172 SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700173 closingHeader( "SCPF" )
174 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700175 SR_choices += adder( "SR", "basic", true, "M", false )
Devin Lime89761a2018-03-16 17:52:57 -0700176 closingHeader( "SR" )
177 addingHeader( "USECASE" )
178 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700179}
180def tuesday( getDay, getResult ){
Devin Lime89761a2018-03-16 17:52:57 -0700181
182 addingHeader( "FUNC" )
Devin Lim61657e42017-10-09 17:24:40 -0700183 FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800184 FUNC_choices += adder( "FUNC", "new_Test", getDay, "T", getResult )
Devin Lim61657e42017-10-09 17:24:40 -0700185 FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700186 closingHeader( "FUNC" )
187 addingHeader( "HA" )
Devin Lim61657e42017-10-09 17:24:40 -0700188 HA_choices += adder( "HA", "basic", getDay, "T", getResult )
189 HA_choices += adder( "HA", "extra_B", getDay, "T", getResult )
Devin Lim61643762017-12-07 15:55:38 -0800190 HA_choices += adder( "HA", "new_Test", getDay, "T", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700191 closingHeader( "HA" )
192 addingHeader( "SCPF" )
Devin Lim61657e42017-10-09 17:24:40 -0700193 SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult )
194 SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700195 closingHeader( "SCPF" )
196 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700197 SR_choices += adder( "SR", "basic", getDay, "T", false )
Devin Lime89761a2018-03-16 17:52:57 -0700198 closingHeader( "SR" )
199 addingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700200 USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult )
201 USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700202 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700203}
204def wednesday( getDay, getResult ){
Devin Lime89761a2018-03-16 17:52:57 -0700205 addingHeader( "FUNC" )
Devin Lim61657e42017-10-09 17:24:40 -0700206 FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800207 FUNC_choices += adder( "FUNC", "new_Test", getDay, "W", getResult )
Devin Lim61657e42017-10-09 17:24:40 -0700208 FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700209 closingHeader( "FUNC" )
210 addingHeader( "HA" )
Devin Lim61657e42017-10-09 17:24:40 -0700211 HA_choices += adder( "HA", "basic", getDay, "W", getResult )
212 HA_choices += adder( "HA", "extra_A", getDay, "W", getResult )
Devin Lim61643762017-12-07 15:55:38 -0800213 //HA_choices += adder( "HA", "new_Test", getDay, "W", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700214 closingHeader( "HA" )
215 addingHeader( "SCPF" )
Devin Lim61657e42017-10-09 17:24:40 -0700216 SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult )
217 SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult )
218 SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700219 closingHeader( "SCPF" )
220 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700221 SR_choices += adder( "SR", "basic", getDay, "W", false )
Devin Lime89761a2018-03-16 17:52:57 -0700222 closingHeader( "SR" )
223 addingHeader( "USECASE" )
224 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700225}
226def thursday( getDay, getResult ){
Devin Lime89761a2018-03-16 17:52:57 -0700227 addingHeader( "FUNC" )
Devin Lim61657e42017-10-09 17:24:40 -0700228 FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800229 FUNC_choices += adder( "FUNC", "new_Test", getDay, "Th", getResult )
Devin Lim61657e42017-10-09 17:24:40 -0700230 FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700231 closingHeader( "FUNC" )
232 addingHeader( "HA" )
Devin Lim61657e42017-10-09 17:24:40 -0700233 HA_choices += adder( "HA", "basic", getDay, "Th", getResult )
234 HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult )
Devin Lim61643762017-12-07 15:55:38 -0800235 HA_choices += adder( "HA", "new_Test", getDay, "Th", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700236 closingHeader( "HA" )
237 addingHeader( "SCPF" )
Devin Lim61657e42017-10-09 17:24:40 -0700238 SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult )
239 SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700240 closingHeader( "SCPF" )
241 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700242 SR_choices += adder( "SR", "basic", getDay, "Th", false )
Devin Lime89761a2018-03-16 17:52:57 -0700243 closingHeader( "SR" )
244 addingHeader( "USECASE" )
245 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700246}
247def friday( getDay, getResult ){
Devin Lime89761a2018-03-16 17:52:57 -0700248 addingHeader( "FUNC" )
Devin Lim61657e42017-10-09 17:24:40 -0700249 FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800250 FUNC_choices += adder( "FUNC", "new_Test", getDay, "F", getResult )
Devin Lim61657e42017-10-09 17:24:40 -0700251 FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700252 closingHeader( "FUNC" )
253 addingHeader( "HA" )
Devin Lim61657e42017-10-09 17:24:40 -0700254 HA_choices += adder( "HA", "basic", getDay, "F", getResult )
255 HA_choices += adder( "HA", "extra_A", getDay, "F", getResult )
Devin Lim61643762017-12-07 15:55:38 -0800256 //HA_choices += adder( "HA", "new_Test", getDay, "F", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700257 closingHeader( "HA" )
258 addingHeader( "SCPF" )
Devin Lim61657e42017-10-09 17:24:40 -0700259 SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult )
260 SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult )
261 SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult )
Devin Lime89761a2018-03-16 17:52:57 -0700262 closingHeader( "SCPF" )
263 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700264 SR_choices += adder( "SR", "basic", getDay, "F", false )
Devin Lime89761a2018-03-16 17:52:57 -0700265 closingHeader( "SR" )
266 addingHeader( "USECASE" )
267 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700268}
Devin Lime89761a2018-03-16 17:52:57 -0700269def saturday( getDay, getResult ){
270 addingHeader( "FUNC" )
271 FUNC_choices += adder( "FUNC", "basic", getDay, "Sa", getResult )
272 FUNC_choices += adder( "FUNC", "extra_A", getDay, "Sa", getResult )
273 FUNC_choices += adder( "FUNC", "extra_B", getDay, "Sa", getResult )
274 FUNC_choices += adder( "FUNC", "new_Test", getDay, "Sa", getResult )
275 closingHeader( "FUNC" )
276 addingHeader( "HA" )
277 HA_choices += adder( "HA", "basic", getDay, "Sa", getResult )
278 HA_choices += adder( "HA", "extra_A", getDay, "Sa", getResult )
279 HA_choices += adder( "HA", "extra_B", getDay, "Sa", getResult )
280 HA_choices += adder( "HA", "new_Test", getDay, "Sa", getResult )
281 closingHeader( "HA" )
282 addingHeader( "SCPF" )
283 SCPF_choices += adder( "SCPF", "basic", getDay, "Sa", getResult )
284 SCPF_choices += adder( "SCPF", "extra_A", getDay, "Sa", getResult )
285 SCPF_choices += adder( "SCPF", "extra_B", getDay, "Sa", getResult )
286 SCPF_choices += adder( "SCPF", "extra_C", getDay, "Sa", getResult )
287 SCPF_choices += adder( "SCPF", "extra_D", getDay, "Sa", getResult )
288 SCPF_choices += adder( "SCPF", "new_Test", getDay, "Sa", getResult )
289 closingHeader( "SCPF" )
290 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700291 SR_choices += adder( "SR", "basic", getDay, "Sa", false )
Devin Lime89761a2018-03-16 17:52:57 -0700292 closingHeader( "SR" )
293 addingHeader( "USECASE" )
294 USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult )
295 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700296}
Devin Lime89761a2018-03-16 17:52:57 -0700297def sunday( getDay, getResult ){
298 addingHeader( "FUNC" )
299 FUNC_choices += adder( "FUNC", "basic", getDay, "S", getResult )
300 FUNC_choices += adder( "FUNC", "extra_A", getDay, "S", getResult )
301 FUNC_choices += adder( "FUNC", "extra_B", getDay, "S", getResult )
302 closingHeader( "FUNC" )
303 addingHeader( "HA" )
304 HA_choices += adder( "HA", "basic", getDay, "S", getResult )
305 HA_choices += adder( "HA", "extra_A", getDay, "S", getResult )
306 HA_choices += adder( "HA", "extra_B", getDay, "S", getResult )
307 closingHeader( "HA" )
308 addingHeader( "SCPF" )
309 SCPF_choices += adder( "SCPF", "basic", getDay, "S", getResult )
310 SCPF_choices += adder( "SCPF", "extra_A", getDay, "S", getResult )
311 SCPF_choices += adder( "SCPF", "extra_B", getDay, "S", getResult )
312 SCPF_choices += adder( "SCPF", "extra_C", getDay, "S", getResult )
313 SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult )
314 closingHeader( "SCPF" )
315 addingHeader( "SR" )
Devin Lim431408d2018-03-23 17:51:31 -0700316 SR_choices += adder( "SR", "basic", getDay, "S", false )
Devin Lime89761a2018-03-16 17:52:57 -0700317 closingHeader( "SR" )
318 addingHeader( "USECASE" )
319 USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult )
320 closingHeader( "USECASE" )
Devin Lim61657e42017-10-09 17:24:40 -0700321}
322def adder( testCat, set, dayAdding, day, getResult ){
323 result = ""
Devin Lime89761a2018-03-16 17:52:57 -0700324 for( String test in AllTheTests[ testCat ].keySet() ){
Devin Lim61657e42017-10-09 17:24:40 -0700325 if( AllTheTests[ testCat ][ test ][ set ] ){
326 if( getResult )
327 result += test + ","
328 if( dayAdding )
329 dayAdder( testCat, test, day )
Devin Lime89761a2018-03-16 17:52:57 -0700330 makeHtmlColList( testCat, test )
Devin Lim61657e42017-10-09 17:24:40 -0700331 }
332 }
333 return result
334}
Devin Lime89761a2018-03-16 17:52:57 -0700335def initHtmlForWiki(){
336 wikiContents = '''
337 <table class="wrapped confluenceTable">
338 <colgroup>
339 <col />
340 <col />
341 <col />
342 <col />
343 <col />
344 <col />
345 </colgroup>
346 <tbody>
347 <tr>
348 <th colspan="1" class="confluenceTh">
349 <br />
350 </th>
351 <th class="confluenceTh"><p>Monday</p></th>
352 <th class="confluenceTh"><p>Tuesday</p></th>
353 <th class="confluenceTh"><p>Wednesday</p></th>
354 <th class="confluenceTh"><p>Thursday</p></th>
355 <th class="confluenceTh"><p>Friday</p></th>
356 <th class="confluenceTh"><p>Saturday</p></th>
357 <th class="confluenceTh"><p>Sunday</p></th>
358 </tr>'''
359 for( String test in testcases.keySet() ){
360 testcases[ test ][ 'wikiContent' ] = '''
361 <tr>
362 <th colspan="1" class="confluenceTh">''' + test + '''</th>'''
363 }
364}
365def addingHeader( testCategory ){
366 testcases[ testCategory ][ 'wikiContent' ] += '''
367 <td class="confluenceTd">
368 <ul>'''
369}
370def makeHtmlColList( testCategory, testName ){
371 testcases[ testCategory ][ 'wikiContent' ] += '''
372 <li>'''+ testName +'''</li>'''
373
374}
375def closingHeader( testCategory ){
376 testcases[ testCategory ][ 'wikiContent' ] += '''
377 </ul>
378 </td>'''
379}
380def closeHtmlForWiki(){
381 for( String test in testcases.keySet() ){
382 wikiContents += testcases[ test ][ 'wikiContent' ]
383 wikiContents += '''
384 </tr>'''
385 }
386 wikiContents += '''
387 </tbody>
388 </table>
389 <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every branch.</p>
390 <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p>
391 <p>On <strong>Saturdays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( previous_version ) +''' branch.</p>
392 <p>On <strong>Sundays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( before_previous_version ) +''' branch.</p>'''
393}
394def postToWiki( contents ){
395 node( testMachine ){
396 workspace = "/var/jenkins/workspace/all-pipeline-trigger/"
397 filename = "jenkinsSchedule.txt"
398 writeFile file: workspace + filename, text: contents
399 funcs.publishToConfluence( "false", "true",
400 "Automated Test Schedule",
401 workspace + filename )
402 }
403}
Devin Lim61657e42017-10-09 17:24:40 -0700404def dayAdder( testCat, testName, dayOfWeek ){
405 AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + ","
Devin Lim431408d2018-03-23 17:51:31 -0700406}