blob: d203f07cd26a7ea1ff68fba18cc3dd4d353054b9 [file] [log] [blame]
Devin Lime1346f42018-05-15 15:41:36 -07001#!groovy
Devin Limf5175192018-05-14 19:13:22 -07002// 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 vm-pipeline-trigger or bm-pipeline-trigger
22
Devin Limf5175192018-05-14 19:13:22 -070023// set the functions of the dependencies.
Devin Limb734ea52018-05-14 14:13:05 -070024funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
25test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
26triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/TriggerFuncs.groovy' )
27fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
Devin Lim2edfcec2018-05-09 17:16:21 -070028
Devin Limf5175192018-05-14 19:13:22 -070029// set the versions of the onos
Devin Limfe9a4cb2018-05-11 17:06:21 -070030fileRelated.init()
Devin Lim2edfcec2018-05-09 17:16:21 -070031current_version = "master"
32previous_version = "1.13"
33before_previous_version = "1.12"
Devin Limf5175192018-05-14 19:13:22 -070034
35// init trend graphs to be on VM.
Devin Lim2edfcec2018-05-09 17:16:21 -070036funcs.initializeTrend( "VM" );
37triggerFuncs.init( funcs )
Devin Limf5175192018-05-14 19:13:22 -070038
39// contents for page https://wiki.onosproject.org/display/ONOS/Automated+Test+Schedule
40// which will demonstrates the list of the scheduled tests on the days.
Devin Lim2edfcec2018-05-09 17:16:21 -070041wikiContents = ""
Devin Limf5175192018-05-14 19:13:22 -070042
43// default FUNC,HA to be VM, SCPF,USECASE to be BM.
44// SR will not be used in here.
Devin Lim2edfcec2018-05-09 17:16:21 -070045testcases = [
Jon Hall6af749d2018-05-29 12:59:47 -070046 "FUNC": [ tests: "", nodeName: "VM", wikiContent: "" ],
47 "HA": [ tests: "", nodeName: "VM", wikiContent: "" ],
48 "SCPF": [ tests: "", nodeName: "BM", wikiContent: "" ],
49 "SR": [ tests: "", nodeName: "Fabric", wikiContent: "" ],
50 "USECASE": [ tests: "", nodeName: "BM", wikiContent: "" ]
Devin Lim2edfcec2018-05-09 17:16:21 -070051]
52
Devin Limf5175192018-05-14 19:13:22 -070053// read the parameters from the Jenkins
Devin Lim2edfcec2018-05-09 17:16:21 -070054manually_run = params.manual_run
Devin Limf5175192018-05-14 19:13:22 -070055
56// set default onos_b to be current_version.
Devin Lim2edfcec2018-05-09 17:16:21 -070057onos_b = current_version
58test_branch = ""
59onos_tag = params.ONOSTag
60isOldFlow = true
61
62// Set tests based on day of week
63def now = funcs.getCurrentTime()
64print now.toString()
65today = now[ Calendar.DAY_OF_WEEK ]
66
Devin Limf5175192018-05-14 19:13:22 -070067// get branch from parameter if it is manually running
Devin Lim2edfcec2018-05-09 17:16:21 -070068if ( manually_run ){
69 onos_b = params.ONOSVersion
Jon Hall6af749d2018-05-29 12:59:47 -070070}
71else {
Devin Limf5175192018-05-14 19:13:22 -070072 // otherwise, the version would be different over the weekend.
73 // If today is weekdays, it will be default to current_version.
Devin Lim2edfcec2018-05-09 17:16:21 -070074 if ( today == Calendar.SATURDAY ){
75 onos_b = previous_version
Jon Hall6af749d2018-05-29 12:59:47 -070076 }
77 else if ( today == Calendar.SUNDAY ){
Devin Lim2edfcec2018-05-09 17:16:21 -070078 onos_b = before_previous_version
79 }
80}
Devin Limf5175192018-05-14 19:13:22 -070081
82// Get all the list of the tests from the JenkinsTestONTests.groovy
Devin Lim2edfcec2018-05-09 17:16:21 -070083AllTheTests = test_lists.getAllTheTests( onos_b )
84
Devin Limf5175192018-05-14 19:13:22 -070085// list of the tests to be run will be saved in each choices.
Devin Lim2edfcec2018-05-09 17:16:21 -070086day = ""
87SCPF_choices = ""
88USECASE_choices = ""
89FUNC_choices = ""
90HA_choices = ""
91SR_choices = ""
Devin Limf5175192018-05-14 19:13:22 -070092
93// init some paths for the files and directories.
Devin Limfe9a4cb2018-05-11 17:06:21 -070094stat_graph_generator_file = fileRelated.histogramMultiple
95pie_graph_generator_file = fileRelated.pieMultiple
96graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
Devin Lim2edfcec2018-05-09 17:16:21 -070097
Devin Limf5175192018-05-14 19:13:22 -070098// get post result from the params for manually run.
Devin Lim2edfcec2018-05-09 17:16:21 -070099post_result = params.PostResult
Devin Limf5175192018-05-14 19:13:22 -0700100
101// if automatically run, it will remove the comma at the end after dividing the tests.
Jon Hall6af749d2018-05-29 12:59:47 -0700102if ( !manually_run ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700103 testDivider( today )
Jon Hall6af749d2018-05-29 12:59:47 -0700104 FUNC_choices = triggerFuncs.lastCommaRemover( FUNC_choices )
105 HA_choices = triggerFuncs.lastCommaRemover( HA_choices )
106 SCPF_choices = triggerFuncs.lastCommaRemover( SCPF_choices )
107 USECASE_choices = triggerFuncs.lastCommaRemover( USECASE_choices )
108 SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
Devin Lim2edfcec2018-05-09 17:16:21 -0700109}
110
Devin Limf5175192018-05-14 19:13:22 -0700111
Devin Lim2edfcec2018-05-09 17:16:21 -0700112if ( manually_run ){
113 testcases = triggerFuncs.organize_tests( params.Tests, testcases )
114
115 isOldFlow = params.isOldFlow
116 println "Tests to be run manually : "
Jon Hall6af749d2018-05-29 12:59:47 -0700117}
118else {
Devin Lim2edfcec2018-05-09 17:16:21 -0700119 testcases[ "SCPF" ][ "tests" ] = SCPF_choices
120 testcases[ "USECASE" ][ "tests" ] = USECASE_choices
121 testcases[ "FUNC" ][ "tests" ] = FUNC_choices
122 testcases[ "HA" ][ "tests" ] = HA_choices
123 testcases[ "SR" ][ "tests" ] = SR_choices
124 println "Defaulting to " + day + " tests:"
125}
126
127triggerFuncs.print_tests( testcases )
128
129def runTest = [
Jon Hall6af749d2018-05-29 12:59:47 -0700130 "VM": [ : ],
131 "BM": [ : ]
Devin Lim2edfcec2018-05-09 17:16:21 -0700132]
Devin Limf5175192018-05-14 19:13:22 -0700133
134// set the test running function into the dictionary.
Jon Hall6af749d2018-05-29 12:59:47 -0700135for ( String test in testcases.keySet() ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700136 println test
137 if ( testcases[ test ][ "tests" ] != "" ){
Jon Hall6af749d2018-05-29 12:59:47 -0700138 runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs.
139 trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test,
140 manually_run, onos_tag )
Devin Lim2edfcec2018-05-09 17:16:21 -0700141 }
142}
Jon Hall6af749d2018-05-29 12:59:47 -0700143def finalList = [ : ]
Devin Limf5175192018-05-14 19:13:22 -0700144
145// get the name of the job.
Devin Limb91bf792018-05-10 15:09:52 -0700146jobName = env.JOB_NAME
Devin Limf5175192018-05-14 19:13:22 -0700147
148// first set the list of the functions to be run.
Devin Lim2edfcec2018-05-09 17:16:21 -0700149finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] )
150finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] )
Devin Limf5175192018-05-14 19:13:22 -0700151
152// if first two character of the job name is vm, only call VM.
153// else, only on BM
Jon Hall6af749d2018-05-29 12:59:47 -0700154if ( jobName.take( 2 ) == "vm" ){
Devin Limb91bf792018-05-10 15:09:52 -0700155 finalList[ "VM" ].call()
Jon Hall6af749d2018-05-29 12:59:47 -0700156}
157else {
Devin Limb91bf792018-05-10 15:09:52 -0700158 finalList[ "BM" ].call()
Jon Hall6af749d2018-05-29 12:59:47 -0700159}
Devin Lim2edfcec2018-05-09 17:16:21 -0700160
Devin Limf5175192018-05-14 19:13:22 -0700161// If it is automated running, it will generate the stats graph on VM.
Devin Lim2edfcec2018-05-09 17:16:21 -0700162if ( !manually_run ){
163 funcs.generateStatGraph( "TestStation-VMs",
164 funcs.branchWithPrefix( onos_b ),
165 AllTheTests,
166 stat_graph_generator_file,
167 pie_graph_generator_file,
168 graph_saved_directory )
169}
170
Devin Limf5175192018-05-14 19:13:22 -0700171// function that will divide tests depends on which day it is.
Devin Lim2edfcec2018-05-09 17:16:21 -0700172def testDivider( today ){
Jon Hall6af749d2018-05-29 12:59:47 -0700173 switch ( today ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700174 case Calendar.MONDAY:
Devin Limf5175192018-05-14 19:13:22 -0700175 // THe reason Monday calls all the days is because we want to post the test schedules on the wiki
176 // and slack channel every monday.
177 // It will only generate the list of the test for monday.
Devin Lim2edfcec2018-05-09 17:16:21 -0700178 initHtmlForWiki()
179 monday( true )
180 tuesday( true, false )
181 wednesday( true, false )
182 thursday( true, false )
183 friday( true, false )
184 saturday( false, false )
185 sunday( false, false )
186 day = "Monday"
187 closeHtmlForWiki()
188 postToWiki( wikiContents )
Jon Hall6af749d2018-05-29 12:59:47 -0700189 slackSend( color: '#FFD988',
190 message: "Tests to be run this weekdays : \n" +
191 triggerFuncs.printDaysForTest( AllTheTests ) )
Devin Lim2edfcec2018-05-09 17:16:21 -0700192 break
193 case Calendar.TUESDAY:
194 tuesday( false, true )
195 day = "Tuesday"
196 break
197 case Calendar.WEDNESDAY:
198 wednesday( false, true )
199 day = "Wednesday"
200 break
201 case Calendar.THURSDAY:
202 thursday( false, true )
203 day = "Thursday"
204 break
205 case Calendar.FRIDAY:
206 friday( false, true )
207 day = "Friday"
208 break
209 case Calendar.SATURDAY:
210 saturday( false, true )
211 day = "Saturday"
212 break
213 case Calendar.SUNDAY:
Jon Hall6af749d2018-05-29 12:59:47 -0700214 sunday( false, true )
Devin Lim2edfcec2018-05-09 17:16:21 -0700215 day = "Sunday"
216 break
217 }
218}
Devin Limf5175192018-05-14 19:13:22 -0700219
220// function for monday.
Devin Lim2edfcec2018-05-09 17:16:21 -0700221def monday( getResult ){
Devin Limf5175192018-05-14 19:13:22 -0700222 // add header for wiki page script.
Devin Lim2edfcec2018-05-09 17:16:21 -0700223 addingHeader( "FUNC" )
Devin Limf5175192018-05-14 19:13:22 -0700224 // call category of basic and extra_A of FUNC tests.
225 // put M into the dictionary.
Devin Lim2edfcec2018-05-09 17:16:21 -0700226 FUNC_choices += adder( "FUNC", "basic", true, "M", getResult )
227 FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult )
228 closingHeader( "FUNC" )
229 addingHeader( "HA" )
230 HA_choices += adder( "HA", "basic", true, "M", getResult )
231 HA_choices += adder( "HA", "extra_A", true, "M", getResult )
232 closingHeader( "HA" )
233 addingHeader( "SCPF" )
234 SCPF_choices += adder( "SCPF", "basic", true, "M", getResult )
235 SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult )
236 closingHeader( "SCPF" )
237 addingHeader( "SR" )
238 SR_choices += adder( "SR", "basic", true, "M", false )
239 closingHeader( "SR" )
240 addingHeader( "USECASE" )
241 closingHeader( "USECASE" )
242}
Devin Limf5175192018-05-14 19:13:22 -0700243
244// If get result is false, it will not add the test result to xx_choices, but will generate the
245// header and days
Devin Lim2edfcec2018-05-09 17:16:21 -0700246def tuesday( getDay, getResult ){
247 addingHeader( "FUNC" )
248 FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult )
249 FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult )
250 closingHeader( "FUNC" )
251 addingHeader( "HA" )
252 HA_choices += adder( "HA", "basic", getDay, "T", getResult )
253 HA_choices += adder( "HA", "extra_B", getDay, "T", getResult )
254 closingHeader( "HA" )
255 addingHeader( "SCPF" )
256 SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult )
257 SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult )
258 closingHeader( "SCPF" )
259 addingHeader( "SR" )
260 SR_choices += adder( "SR", "basic", getDay, "T", false )
261 closingHeader( "SR" )
262 addingHeader( "USECASE" )
263 USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult )
264 USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult )
265 closingHeader( "USECASE" )
266}
Jon Hall6af749d2018-05-29 12:59:47 -0700267
Devin Lim2edfcec2018-05-09 17:16:21 -0700268def wednesday( getDay, getResult ){
269 addingHeader( "FUNC" )
270 FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult )
271 FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult )
272 closingHeader( "FUNC" )
273 addingHeader( "HA" )
274 HA_choices += adder( "HA", "basic", getDay, "W", getResult )
275 HA_choices += adder( "HA", "extra_A", getDay, "W", getResult )
276 closingHeader( "HA" )
277 addingHeader( "SCPF" )
278 SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult )
279 SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult )
280 closingHeader( "SCPF" )
281 addingHeader( "SR" )
282 SR_choices += adder( "SR", "basic", getDay, "W", false )
283 closingHeader( "SR" )
284 addingHeader( "USECASE" )
285 closingHeader( "USECASE" )
286}
Jon Hall6af749d2018-05-29 12:59:47 -0700287
Devin Lim2edfcec2018-05-09 17:16:21 -0700288def thursday( getDay, getResult ){
289 addingHeader( "FUNC" )
290 FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult )
291 FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult )
292 closingHeader( "FUNC" )
293 addingHeader( "HA" )
294 HA_choices += adder( "HA", "basic", getDay, "Th", getResult )
295 HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult )
296 closingHeader( "HA" )
297 addingHeader( "SCPF" )
298 SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult )
299 SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult )
300 closingHeader( "SCPF" )
301 addingHeader( "SR" )
302 SR_choices += adder( "SR", "basic", getDay, "Th", false )
303 closingHeader( "SR" )
304 addingHeader( "USECASE" )
305 closingHeader( "USECASE" )
306}
Jon Hall6af749d2018-05-29 12:59:47 -0700307
Devin Lim2edfcec2018-05-09 17:16:21 -0700308def friday( getDay, getResult ){
309 addingHeader( "FUNC" )
310 FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult )
311 FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult )
312 closingHeader( "FUNC" )
313 addingHeader( "HA" )
314 HA_choices += adder( "HA", "basic", getDay, "F", getResult )
315 HA_choices += adder( "HA", "extra_A", getDay, "F", getResult )
316 closingHeader( "HA" )
317 addingHeader( "SCPF" )
318 SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult )
319 SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult )
320 SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult )
321 closingHeader( "SCPF" )
322 addingHeader( "SR" )
323 SR_choices += adder( "SR", "basic", getDay, "F", false )
324 SR_choices += adder( "SR", "extra_A", getDay, "F", false )
325 closingHeader( "SR" )
326 addingHeader( "USECASE" )
327 closingHeader( "USECASE" )
328}
Jon Hall6af749d2018-05-29 12:59:47 -0700329
Devin Lim2edfcec2018-05-09 17:16:21 -0700330def saturday( getDay, getResult ){
331 addingHeader( "FUNC" )
332 FUNC_choices += adder( "FUNC", "basic", getDay, "Sa", getResult )
333 FUNC_choices += adder( "FUNC", "extra_A", getDay, "Sa", getResult )
334 FUNC_choices += adder( "FUNC", "extra_B", getDay, "Sa", getResult )
335 closingHeader( "FUNC" )
336 addingHeader( "HA" )
337 HA_choices += adder( "HA", "basic", getDay, "Sa", getResult )
338 HA_choices += adder( "HA", "extra_A", getDay, "Sa", getResult )
339 HA_choices += adder( "HA", "extra_B", getDay, "Sa", getResult )
340 closingHeader( "HA" )
341 addingHeader( "SCPF" )
342 SCPF_choices += adder( "SCPF", "basic", getDay, "Sa", getResult )
343 SCPF_choices += adder( "SCPF", "extra_A", getDay, "Sa", getResult )
344 SCPF_choices += adder( "SCPF", "extra_B", getDay, "Sa", getResult )
345 SCPF_choices += adder( "SCPF", "extra_C", getDay, "Sa", getResult )
346 SCPF_choices += adder( "SCPF", "extra_D", getDay, "Sa", getResult )
347 closingHeader( "SCPF" )
348 addingHeader( "SR" )
349 SR_choices += adder( "SR", "basic", getDay, "Sa", false )
350 SR_choices += adder( "SR", "extra_B", getDay, "Sa", false )
351 closingHeader( "SR" )
352 addingHeader( "USECASE" )
353 USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult )
354 closingHeader( "USECASE" )
355}
Jon Hall6af749d2018-05-29 12:59:47 -0700356
Devin Lim2edfcec2018-05-09 17:16:21 -0700357def sunday( getDay, getResult ){
358 addingHeader( "FUNC" )
359 FUNC_choices += adder( "FUNC", "basic", getDay, "S", getResult )
360 FUNC_choices += adder( "FUNC", "extra_A", getDay, "S", getResult )
361 FUNC_choices += adder( "FUNC", "extra_B", getDay, "S", getResult )
362 closingHeader( "FUNC" )
363 addingHeader( "HA" )
364 HA_choices += adder( "HA", "basic", getDay, "S", getResult )
365 HA_choices += adder( "HA", "extra_A", getDay, "S", getResult )
366 HA_choices += adder( "HA", "extra_B", getDay, "S", getResult )
367 closingHeader( "HA" )
368 addingHeader( "SCPF" )
369 SCPF_choices += adder( "SCPF", "basic", getDay, "S", getResult )
370 SCPF_choices += adder( "SCPF", "extra_A", getDay, "S", getResult )
371 SCPF_choices += adder( "SCPF", "extra_B", getDay, "S", getResult )
372 SCPF_choices += adder( "SCPF", "extra_C", getDay, "S", getResult )
373 SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult )
374 closingHeader( "SCPF" )
375 addingHeader( "SR" )
376 SR_choices += adder( "SR", "basic", getDay, "S", false )
377 closingHeader( "SR" )
378 addingHeader( "USECASE" )
379 USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult )
380 closingHeader( "USECASE" )
381}
Devin Limf5175192018-05-14 19:13:22 -0700382
383// adder that will return the list of the tests.
Devin Lim2edfcec2018-05-09 17:16:21 -0700384def adder( testCat, set, dayAdding, day, getResult ){
Devin Limf5175192018-05-14 19:13:22 -0700385 // testCat : the category of the test which will be either FUNC,HA,SR...
386 // set : the set of the test to be run which will be basic,extra_A,extra_B...
387 // dayAdding : boolean whether to add the days into the list or not
388 // day : the day you are trying to add (m,t,w,th... )
389 // getResult : if want to get the list of the test to be run. False will return empty list.
390 // And once the list is empty, it will not be run.
Jon Hall6af749d2018-05-29 12:59:47 -0700391 def result = ""
392 for ( String test in AllTheTests[ testCat ].keySet() ){
393 if ( AllTheTests[ testCat ][ test ][ set ] ){
394 if ( getResult ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700395 result += test + ","
Jon Hall6af749d2018-05-29 12:59:47 -0700396 }
397 if ( dayAdding ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700398 dayAdder( testCat, test, day )
Jon Hall6af749d2018-05-29 12:59:47 -0700399 }
Devin Limf5175192018-05-14 19:13:22 -0700400 // make HTML columns for wiki page on schedule.
Devin Lim2edfcec2018-05-09 17:16:21 -0700401 makeHtmlColList( testCat, test )
402 }
403 }
404 return result
405}
Devin Limf5175192018-05-14 19:13:22 -0700406
407// Initial part of the wiki page.
Devin Lim2edfcec2018-05-09 17:16:21 -0700408def initHtmlForWiki(){
409 wikiContents = '''
410 <table class="wrapped confluenceTable">
411 <colgroup>
412 <col />
413 <col />
414 <col />
415 <col />
416 <col />
417 <col />
418 </colgroup>
419 <tbody>
420 <tr>
421 <th colspan="1" class="confluenceTh">
422 <br />
423 </th>
424 <th class="confluenceTh"><p>Monday</p></th>
425 <th class="confluenceTh"><p>Tuesday</p></th>
426 <th class="confluenceTh"><p>Wednesday</p></th>
427 <th class="confluenceTh"><p>Thursday</p></th>
428 <th class="confluenceTh"><p>Friday</p></th>
429 <th class="confluenceTh"><p>Saturday</p></th>
430 <th class="confluenceTh"><p>Sunday</p></th>
431 </tr>'''
Jon Hall6af749d2018-05-29 12:59:47 -0700432 for ( String test in testcases.keySet() ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700433 testcases[ test ][ 'wikiContent' ] = '''
434 <tr>
435 <th colspan="1" class="confluenceTh">''' + test + '''</th>'''
436 }
437}
Devin Limf5175192018-05-14 19:13:22 -0700438
439// adding header functionality.
Devin Lim2edfcec2018-05-09 17:16:21 -0700440def addingHeader( testCategory ){
441 testcases[ testCategory ][ 'wikiContent' ] += '''
442 <td class="confluenceTd">
443 <ul>'''
444}
Devin Limf5175192018-05-14 19:13:22 -0700445
446// making column list for html
Devin Lim2edfcec2018-05-09 17:16:21 -0700447def makeHtmlColList( testCategory, testName ){
448 testcases[ testCategory ][ 'wikiContent' ] += '''
Jon Hall6af749d2018-05-29 12:59:47 -0700449 <li>''' + testName + '''</li>'''
Devin Lim2edfcec2018-05-09 17:16:21 -0700450
451}
Devin Limf5175192018-05-14 19:13:22 -0700452
453// closing the header for html
Devin Lim2edfcec2018-05-09 17:16:21 -0700454def closingHeader( testCategory ){
455 testcases[ testCategory ][ 'wikiContent' ] += '''
456 </ul>
457 </td>'''
458}
Devin Limf5175192018-05-14 19:13:22 -0700459
460// close the html for the wiki page.
Devin Lim2edfcec2018-05-09 17:16:21 -0700461def closeHtmlForWiki(){
Jon Hall6af749d2018-05-29 12:59:47 -0700462 for ( String test in testcases.keySet() ){
Devin Lim2edfcec2018-05-09 17:16:21 -0700463 wikiContents += testcases[ test ][ 'wikiContent' ]
464 wikiContents += '''
465 </tr>'''
466 }
467 wikiContents += '''
468 </tbody>
469 </table>
470 <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every supported branch.</p>
471 <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p>
Jon Hall6af749d2018-05-29 12:59:47 -0700472 <p>On <strong>Saturdays</strong>, all the other tests are built and run on the ''' +
473 funcs.branchWithPrefix( previous_version ) + ''' branch.</p>
474 <p>On <strong>Sundays</strong>, all the other tests are built and run on the ''' +
475 funcs.branchWithPrefix( before_previous_version ) + ''' branch.</p>'''
Devin Lim2edfcec2018-05-09 17:16:21 -0700476}
Devin Limf5175192018-05-14 19:13:22 -0700477
478// post the result to wiki page using publish to confluence.
Devin Lim2edfcec2018-05-09 17:16:21 -0700479def postToWiki( contents ){
Jon Hall6af749d2018-05-29 12:59:47 -0700480 node( testMachine ) {
Devin Limfe9a4cb2018-05-11 17:06:21 -0700481 workspace = fileRelated.jenkinsWorkspace + "all-pipeline-trigger/"
Devin Lim2edfcec2018-05-09 17:16:21 -0700482 filename = "jenkinsSchedule.txt"
483 writeFile file: workspace + filename, text: contents
484 funcs.publishToConfluence( "false", "true",
485 "Automated Test Schedule",
486 workspace + filename )
487 }
488}
Devin Limf5175192018-05-14 19:13:22 -0700489
490// add the day to the "day" on the dictionary.
Devin Lim2edfcec2018-05-09 17:16:21 -0700491def dayAdder( testCat, testName, dayOfWeek ){
492 AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + ","
493}