Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 1 | #!groovy |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 2 | |
Devin Lim | 81ab48b | 2018-02-09 14:24:57 -0800 | [diff] [blame] | 3 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 4 | test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 5 | triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 6 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 7 | previous_version = "1.12" |
Devin Lim | 3fa96a9 | 2018-03-16 11:47:58 -0700 | [diff] [blame] | 8 | before_previous_version = "1.11" |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 9 | funcs.initializeTrend( "VM" ); |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 10 | triggerFuncs.init( funcs ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 11 | wikiContents = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 12 | testcases = [ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 13 | "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ], |
| 14 | "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ], |
| 15 | "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ], |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 16 | "SR" : [ tests : "", nodeName : "Fabric", wikiContent : "" ], |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 17 | "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ] |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 18 | ] |
| 19 | Prefix_organizer = [ |
| 20 | "FU" : "FUNC", |
| 21 | "HA" : "HA", |
| 22 | "PL" : "USECASE", |
| 23 | "SA" : "USECASE", |
| 24 | "SC" : "SCPF", |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 25 | "SR" : "SR", |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 26 | "US" : "USECASE", |
| 27 | "VP" : "USECASE" |
| 28 | ] |
| 29 | |
Jeremy Ronquillo | cdd177d | 2018-03-09 16:55:44 -0800 | [diff] [blame] | 30 | manually_run = params.manual_run |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 31 | onos_b = "master" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 32 | test_branch = "" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 33 | onos_tag = params.ONOSTag |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 34 | isOldFlow = true |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 35 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 36 | // Set tests based on day of week |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 37 | def now = funcs.getCurrentTime() |
| 38 | print now.toString() |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 39 | today = now[ Calendar.DAY_OF_WEEK ] |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 40 | |
Jeremy Ronquillo | cdd177d | 2018-03-09 16:55:44 -0800 | [diff] [blame] | 41 | if ( 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 Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 49 | } |
| 50 | AllTheTests = test_lists.getAllTheTests( onos_b ) |
| 51 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 52 | day = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 53 | SCPF_choices = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 54 | USECASE_choices = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 55 | FUNC_choices = "" |
| 56 | HA_choices = "" |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 57 | SR_choices = "" |
| 58 | stat_graph_generator_file = "testCategoryBuildStats.R" |
| 59 | pie_graph_generator_file = "testCategoryPiePassFail.R" |
| 60 | graph_saved_directory = "/var/jenkins/workspace/postjob-VM/" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 61 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 62 | post_result = params.PostResult |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 63 | if( !manually_run ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 64 | 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 Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 68 | testDivider( today ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 69 | 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 Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 74 | } |
| 75 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 76 | if ( manually_run ){ |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 77 | testcases = triggerFuncs.organize_tests( params.Tests, testcases ) |
Jeremy Ronquillo | cdd177d | 2018-03-09 16:55:44 -0800 | [diff] [blame] | 78 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 79 | isOldFlow = params.isOldFlow |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 80 | println "Tests to be run manually : " |
| 81 | }else{ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 82 | 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 Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 87 | println "Defaulting to " + day + " tests:" |
| 88 | } |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 89 | |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 90 | triggerFuncs.print_tests( testcases ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 91 | |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 92 | def runTest = [ |
| 93 | "VM" : [:], |
| 94 | "BM" : [:] |
| 95 | ] |
| 96 | for( String test in testcases.keySet() ){ |
| 97 | println test |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 98 | if ( testcases[ test ][ "tests" ] != "" ){ |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 99 | runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag ) |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 100 | } |
| 101 | } |
| 102 | def finalList = [:] |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 103 | finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] ) |
| 104 | finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] ) |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 105 | parallel finalList |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 106 | //finalList[ "BM" ].call() |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 107 | |
| 108 | if ( !manually_run ){ |
Jeremy Ronquillo | f78a6ca | 2018-03-12 09:20:57 -0700 | [diff] [blame] | 109 | funcs.generateStatGraph( funcs.branchWithPrefix( onos_b ), |
| 110 | AllTheTests, |
| 111 | stat_graph_generator_file, |
| 112 | pie_graph_generator_file, |
| 113 | graph_saved_directory ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 114 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 115 | |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 116 | def testDivider( today ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 117 | switch ( today ) { |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 118 | case Calendar.MONDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 119 | initHtmlForWiki() |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 120 | monday( true ) |
| 121 | tuesday( true, false ) |
| 122 | wednesday( true, false ) |
| 123 | thursday( true, false ) |
| 124 | friday( true, false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 125 | saturday( false, false ) |
| 126 | sunday( false, false ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 127 | day = "Monday" |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 128 | closeHtmlForWiki() |
| 129 | postToWiki( wikiContents ) |
Devin Lim | 41f087a | 2018-03-27 12:28:08 -0700 | [diff] [blame^] | 130 | slackSend( color:'#FFD988', message:"Tests to be run this weekdays : \n" + triggerFuncs.printDaysForTest() ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 131 | break |
| 132 | case Calendar.TUESDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 133 | tuesday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 134 | day = "Tuesday" |
| 135 | break |
| 136 | case Calendar.WEDNESDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 137 | wednesday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 138 | day = "Wednesday" |
| 139 | break |
| 140 | case Calendar.THURSDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 141 | thursday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 142 | day = "Thursday" |
| 143 | break |
| 144 | case Calendar.FRIDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 145 | friday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 146 | day = "Friday" |
| 147 | break |
| 148 | case Calendar.SATURDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 149 | saturday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 150 | day = "Saturday" |
| 151 | break |
| 152 | case Calendar.SUNDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 153 | sunday( false , true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 154 | day = "Sunday" |
Devin Lim | 3fa96a9 | 2018-03-16 11:47:58 -0700 | [diff] [blame] | 155 | isOldFlow = false |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 156 | break |
| 157 | } |
| 158 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 159 | def monday( getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 160 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 161 | FUNC_choices += adder( "FUNC", "basic", true, "M", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 162 | FUNC_choices += adder( "FUNC", "new_Test", true, "M", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 163 | FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 164 | closingHeader( "FUNC" ) |
| 165 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 166 | HA_choices += adder( "HA", "basic", true, "M", getResult ) |
| 167 | HA_choices += adder( "HA", "extra_A", true, "M", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 168 | //HA_choices += adder( "HA", "new_Test", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 169 | closingHeader( "HA" ) |
| 170 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 171 | SCPF_choices += adder( "SCPF", "basic", true, "M", getResult ) |
| 172 | SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 173 | closingHeader( "SCPF" ) |
| 174 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 175 | SR_choices += adder( "SR", "basic", true, "M", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 176 | closingHeader( "SR" ) |
| 177 | addingHeader( "USECASE" ) |
| 178 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 179 | } |
| 180 | def tuesday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 181 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 182 | FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 183 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "T", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 184 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 185 | closingHeader( "FUNC" ) |
| 186 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 187 | HA_choices += adder( "HA", "basic", getDay, "T", getResult ) |
| 188 | HA_choices += adder( "HA", "extra_B", getDay, "T", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 189 | HA_choices += adder( "HA", "new_Test", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 190 | closingHeader( "HA" ) |
| 191 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 192 | SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult ) |
| 193 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 194 | closingHeader( "SCPF" ) |
| 195 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 196 | SR_choices += adder( "SR", "basic", getDay, "T", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 197 | closingHeader( "SR" ) |
| 198 | addingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 199 | USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult ) |
| 200 | USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 201 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 202 | } |
| 203 | def wednesday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 204 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 205 | FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 206 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "W", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 207 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 208 | closingHeader( "FUNC" ) |
| 209 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 210 | HA_choices += adder( "HA", "basic", getDay, "W", getResult ) |
| 211 | HA_choices += adder( "HA", "extra_A", getDay, "W", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 212 | //HA_choices += adder( "HA", "new_Test", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 213 | closingHeader( "HA" ) |
| 214 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 215 | SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult ) |
| 216 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult ) |
| 217 | SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 218 | closingHeader( "SCPF" ) |
| 219 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 220 | SR_choices += adder( "SR", "basic", getDay, "W", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 221 | closingHeader( "SR" ) |
| 222 | addingHeader( "USECASE" ) |
| 223 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 224 | } |
| 225 | def thursday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 226 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 227 | FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 228 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "Th", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 229 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 230 | closingHeader( "FUNC" ) |
| 231 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 232 | HA_choices += adder( "HA", "basic", getDay, "Th", getResult ) |
| 233 | HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 234 | HA_choices += adder( "HA", "new_Test", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 235 | closingHeader( "HA" ) |
| 236 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 237 | SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult ) |
| 238 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 239 | closingHeader( "SCPF" ) |
| 240 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 241 | SR_choices += adder( "SR", "basic", getDay, "Th", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 242 | closingHeader( "SR" ) |
| 243 | addingHeader( "USECASE" ) |
| 244 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 245 | } |
| 246 | def friday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 247 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 248 | FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 249 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "F", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 250 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 251 | closingHeader( "FUNC" ) |
| 252 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 253 | HA_choices += adder( "HA", "basic", getDay, "F", getResult ) |
| 254 | HA_choices += adder( "HA", "extra_A", getDay, "F", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 255 | //HA_choices += adder( "HA", "new_Test", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 256 | closingHeader( "HA" ) |
| 257 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 258 | SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult ) |
| 259 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult ) |
| 260 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 261 | closingHeader( "SCPF" ) |
| 262 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 263 | SR_choices += adder( "SR", "basic", getDay, "F", false ) |
Devin Lim | be48307 | 2018-03-24 14:37:48 -0700 | [diff] [blame] | 264 | SR_choices += adder( "SR", "extra_A", getDay, "F", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 265 | closingHeader( "SR" ) |
| 266 | addingHeader( "USECASE" ) |
| 267 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 268 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 269 | def 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 Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 291 | SR_choices += adder( "SR", "basic", getDay, "Sa", false ) |
Devin Lim | be48307 | 2018-03-24 14:37:48 -0700 | [diff] [blame] | 292 | SR_choices += adder( "SR", "extra_B", getDay, "Sa", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 293 | closingHeader( "SR" ) |
| 294 | addingHeader( "USECASE" ) |
| 295 | USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult ) |
| 296 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 297 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 298 | def sunday( getDay, getResult ){ |
| 299 | addingHeader( "FUNC" ) |
| 300 | FUNC_choices += adder( "FUNC", "basic", getDay, "S", getResult ) |
| 301 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "S", getResult ) |
| 302 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "S", getResult ) |
| 303 | closingHeader( "FUNC" ) |
| 304 | addingHeader( "HA" ) |
| 305 | HA_choices += adder( "HA", "basic", getDay, "S", getResult ) |
| 306 | HA_choices += adder( "HA", "extra_A", getDay, "S", getResult ) |
| 307 | HA_choices += adder( "HA", "extra_B", getDay, "S", getResult ) |
| 308 | closingHeader( "HA" ) |
| 309 | addingHeader( "SCPF" ) |
| 310 | SCPF_choices += adder( "SCPF", "basic", getDay, "S", getResult ) |
| 311 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "S", getResult ) |
| 312 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "S", getResult ) |
| 313 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "S", getResult ) |
| 314 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult ) |
| 315 | closingHeader( "SCPF" ) |
| 316 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 317 | SR_choices += adder( "SR", "basic", getDay, "S", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 318 | closingHeader( "SR" ) |
| 319 | addingHeader( "USECASE" ) |
| 320 | USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult ) |
| 321 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 322 | } |
| 323 | def adder( testCat, set, dayAdding, day, getResult ){ |
| 324 | result = "" |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 325 | for( String test in AllTheTests[ testCat ].keySet() ){ |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 326 | if( AllTheTests[ testCat ][ test ][ set ] ){ |
| 327 | if( getResult ) |
| 328 | result += test + "," |
| 329 | if( dayAdding ) |
| 330 | dayAdder( testCat, test, day ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 331 | makeHtmlColList( testCat, test ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 332 | } |
| 333 | } |
| 334 | return result |
| 335 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 336 | def initHtmlForWiki(){ |
| 337 | wikiContents = ''' |
| 338 | <table class="wrapped confluenceTable"> |
| 339 | <colgroup> |
| 340 | <col /> |
| 341 | <col /> |
| 342 | <col /> |
| 343 | <col /> |
| 344 | <col /> |
| 345 | <col /> |
| 346 | </colgroup> |
| 347 | <tbody> |
| 348 | <tr> |
| 349 | <th colspan="1" class="confluenceTh"> |
| 350 | <br /> |
| 351 | </th> |
| 352 | <th class="confluenceTh"><p>Monday</p></th> |
| 353 | <th class="confluenceTh"><p>Tuesday</p></th> |
| 354 | <th class="confluenceTh"><p>Wednesday</p></th> |
| 355 | <th class="confluenceTh"><p>Thursday</p></th> |
| 356 | <th class="confluenceTh"><p>Friday</p></th> |
| 357 | <th class="confluenceTh"><p>Saturday</p></th> |
| 358 | <th class="confluenceTh"><p>Sunday</p></th> |
| 359 | </tr>''' |
| 360 | for( String test in testcases.keySet() ){ |
| 361 | testcases[ test ][ 'wikiContent' ] = ''' |
| 362 | <tr> |
| 363 | <th colspan="1" class="confluenceTh">''' + test + '''</th>''' |
| 364 | } |
| 365 | } |
| 366 | def addingHeader( testCategory ){ |
| 367 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 368 | <td class="confluenceTd"> |
| 369 | <ul>''' |
| 370 | } |
| 371 | def makeHtmlColList( testCategory, testName ){ |
| 372 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 373 | <li>'''+ testName +'''</li>''' |
| 374 | |
| 375 | } |
| 376 | def closingHeader( testCategory ){ |
| 377 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 378 | </ul> |
| 379 | </td>''' |
| 380 | } |
| 381 | def closeHtmlForWiki(){ |
| 382 | for( String test in testcases.keySet() ){ |
| 383 | wikiContents += testcases[ test ][ 'wikiContent' ] |
| 384 | wikiContents += ''' |
| 385 | </tr>''' |
| 386 | } |
| 387 | wikiContents += ''' |
| 388 | </tbody> |
| 389 | </table> |
| 390 | <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every branch.</p> |
| 391 | <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p> |
| 392 | <p>On <strong>Saturdays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( previous_version ) +''' branch.</p> |
| 393 | <p>On <strong>Sundays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( before_previous_version ) +''' branch.</p>''' |
| 394 | } |
| 395 | def postToWiki( contents ){ |
| 396 | node( testMachine ){ |
| 397 | workspace = "/var/jenkins/workspace/all-pipeline-trigger/" |
| 398 | filename = "jenkinsSchedule.txt" |
| 399 | writeFile file: workspace + filename, text: contents |
| 400 | funcs.publishToConfluence( "false", "true", |
| 401 | "Automated Test Schedule", |
| 402 | workspace + filename ) |
| 403 | } |
| 404 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 405 | def dayAdder( testCat, testName, dayOfWeek ){ |
| 406 | AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + "," |
Devin Lim | 41f087a | 2018-03-27 12:28:08 -0700 | [diff] [blame^] | 407 | } |