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 | 8d59a33 | 2018-04-16 15:03:55 -0700 | [diff] [blame^] | 7 | previous_version = "master" |
| 8 | before_previous_version = "1.12" |
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 | b6f92de | 2018-04-13 18:27:33 -0700 | [diff] [blame] | 31 | onos_b = "1.13" |
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 ){ |
Devin Lim | 86e4053 | 2018-04-06 12:44:06 -0700 | [diff] [blame] | 109 | funcs.generateStatGraph( "TestStation-VMs", |
| 110 | funcs.branchWithPrefix( onos_b ), |
Jeremy Ronquillo | f78a6ca | 2018-03-12 09:20:57 -0700 | [diff] [blame] | 111 | AllTheTests, |
| 112 | stat_graph_generator_file, |
| 113 | pie_graph_generator_file, |
| 114 | graph_saved_directory ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 115 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 116 | |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 117 | def testDivider( today ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 118 | switch ( today ) { |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 119 | case Calendar.MONDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 120 | initHtmlForWiki() |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 121 | monday( true ) |
| 122 | tuesday( true, false ) |
| 123 | wednesday( true, false ) |
| 124 | thursday( true, false ) |
| 125 | friday( true, false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 126 | saturday( false, false ) |
| 127 | sunday( false, false ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 128 | day = "Monday" |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 129 | closeHtmlForWiki() |
| 130 | postToWiki( wikiContents ) |
Devin Lim | 19d46ba | 2018-04-02 20:52:13 -0700 | [diff] [blame] | 131 | slackSend( color:'#FFD988', message:"Tests to be run this weekdays : \n" + triggerFuncs.printDaysForTest( AllTheTests ) ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 132 | break |
| 133 | case Calendar.TUESDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 134 | tuesday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 135 | day = "Tuesday" |
| 136 | break |
| 137 | case Calendar.WEDNESDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 138 | wednesday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 139 | day = "Wednesday" |
| 140 | break |
| 141 | case Calendar.THURSDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 142 | thursday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 143 | day = "Thursday" |
| 144 | break |
| 145 | case Calendar.FRIDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 146 | friday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 147 | day = "Friday" |
| 148 | break |
| 149 | case Calendar.SATURDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 150 | saturday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 151 | day = "Saturday" |
| 152 | break |
| 153 | case Calendar.SUNDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 154 | sunday( false , true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 155 | day = "Sunday" |
| 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 ) |
| 162 | FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 163 | closingHeader( "FUNC" ) |
| 164 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 165 | HA_choices += adder( "HA", "basic", true, "M", getResult ) |
| 166 | HA_choices += adder( "HA", "extra_A", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 167 | closingHeader( "HA" ) |
| 168 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 169 | SCPF_choices += adder( "SCPF", "basic", true, "M", getResult ) |
| 170 | SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 171 | closingHeader( "SCPF" ) |
| 172 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 173 | SR_choices += adder( "SR", "basic", true, "M", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 174 | closingHeader( "SR" ) |
| 175 | addingHeader( "USECASE" ) |
| 176 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 177 | } |
| 178 | def tuesday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 179 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 180 | FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult ) |
| 181 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 182 | closingHeader( "FUNC" ) |
| 183 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 184 | HA_choices += adder( "HA", "basic", getDay, "T", getResult ) |
| 185 | HA_choices += adder( "HA", "extra_B", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 186 | closingHeader( "HA" ) |
| 187 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 188 | SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult ) |
| 189 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 190 | closingHeader( "SCPF" ) |
| 191 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 192 | SR_choices += adder( "SR", "basic", getDay, "T", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 193 | closingHeader( "SR" ) |
| 194 | addingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 195 | USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult ) |
| 196 | USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 197 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 198 | } |
| 199 | def wednesday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 200 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 201 | FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult ) |
| 202 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 203 | closingHeader( "FUNC" ) |
| 204 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 205 | HA_choices += adder( "HA", "basic", getDay, "W", getResult ) |
| 206 | HA_choices += adder( "HA", "extra_A", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 207 | closingHeader( "HA" ) |
| 208 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 209 | SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult ) |
| 210 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 211 | closingHeader( "SCPF" ) |
| 212 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 213 | SR_choices += adder( "SR", "basic", getDay, "W", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 214 | closingHeader( "SR" ) |
| 215 | addingHeader( "USECASE" ) |
| 216 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 217 | } |
| 218 | def thursday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 219 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 220 | FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult ) |
| 221 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 222 | closingHeader( "FUNC" ) |
| 223 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 224 | HA_choices += adder( "HA", "basic", getDay, "Th", getResult ) |
| 225 | HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 226 | closingHeader( "HA" ) |
| 227 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 228 | SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult ) |
| 229 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 230 | closingHeader( "SCPF" ) |
| 231 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 232 | SR_choices += adder( "SR", "basic", getDay, "Th", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 233 | closingHeader( "SR" ) |
| 234 | addingHeader( "USECASE" ) |
| 235 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 236 | } |
| 237 | def friday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 238 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 239 | FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult ) |
| 240 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 241 | closingHeader( "FUNC" ) |
| 242 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 243 | HA_choices += adder( "HA", "basic", getDay, "F", getResult ) |
| 244 | HA_choices += adder( "HA", "extra_A", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 245 | closingHeader( "HA" ) |
| 246 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 247 | SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult ) |
| 248 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult ) |
| 249 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 250 | closingHeader( "SCPF" ) |
| 251 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 252 | SR_choices += adder( "SR", "basic", getDay, "F", false ) |
Devin Lim | be48307 | 2018-03-24 14:37:48 -0700 | [diff] [blame] | 253 | SR_choices += adder( "SR", "extra_A", getDay, "F", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 254 | closingHeader( "SR" ) |
| 255 | addingHeader( "USECASE" ) |
| 256 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 257 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 258 | def saturday( getDay, getResult ){ |
| 259 | addingHeader( "FUNC" ) |
| 260 | FUNC_choices += adder( "FUNC", "basic", getDay, "Sa", getResult ) |
| 261 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "Sa", getResult ) |
| 262 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Sa", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 263 | closingHeader( "FUNC" ) |
| 264 | addingHeader( "HA" ) |
| 265 | HA_choices += adder( "HA", "basic", getDay, "Sa", getResult ) |
| 266 | HA_choices += adder( "HA", "extra_A", getDay, "Sa", getResult ) |
| 267 | HA_choices += adder( "HA", "extra_B", getDay, "Sa", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 268 | closingHeader( "HA" ) |
| 269 | addingHeader( "SCPF" ) |
| 270 | SCPF_choices += adder( "SCPF", "basic", getDay, "Sa", getResult ) |
| 271 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "Sa", getResult ) |
| 272 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Sa", getResult ) |
| 273 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "Sa", getResult ) |
| 274 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "Sa", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 275 | closingHeader( "SCPF" ) |
| 276 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 277 | SR_choices += adder( "SR", "basic", getDay, "Sa", false ) |
Devin Lim | be48307 | 2018-03-24 14:37:48 -0700 | [diff] [blame] | 278 | SR_choices += adder( "SR", "extra_B", getDay, "Sa", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 279 | closingHeader( "SR" ) |
| 280 | addingHeader( "USECASE" ) |
| 281 | USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult ) |
| 282 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 283 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 284 | def sunday( getDay, getResult ){ |
| 285 | addingHeader( "FUNC" ) |
| 286 | FUNC_choices += adder( "FUNC", "basic", getDay, "S", getResult ) |
| 287 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "S", getResult ) |
| 288 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "S", getResult ) |
| 289 | closingHeader( "FUNC" ) |
| 290 | addingHeader( "HA" ) |
| 291 | HA_choices += adder( "HA", "basic", getDay, "S", getResult ) |
| 292 | HA_choices += adder( "HA", "extra_A", getDay, "S", getResult ) |
| 293 | HA_choices += adder( "HA", "extra_B", getDay, "S", getResult ) |
| 294 | closingHeader( "HA" ) |
| 295 | addingHeader( "SCPF" ) |
| 296 | SCPF_choices += adder( "SCPF", "basic", getDay, "S", getResult ) |
| 297 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "S", getResult ) |
| 298 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "S", getResult ) |
| 299 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "S", getResult ) |
| 300 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult ) |
| 301 | closingHeader( "SCPF" ) |
| 302 | addingHeader( "SR" ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 303 | SR_choices += adder( "SR", "basic", getDay, "S", false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 304 | closingHeader( "SR" ) |
| 305 | addingHeader( "USECASE" ) |
| 306 | USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult ) |
| 307 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 308 | } |
| 309 | def adder( testCat, set, dayAdding, day, getResult ){ |
| 310 | result = "" |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 311 | for( String test in AllTheTests[ testCat ].keySet() ){ |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 312 | if( AllTheTests[ testCat ][ test ][ set ] ){ |
| 313 | if( getResult ) |
| 314 | result += test + "," |
| 315 | if( dayAdding ) |
| 316 | dayAdder( testCat, test, day ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 317 | makeHtmlColList( testCat, test ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 318 | } |
| 319 | } |
| 320 | return result |
| 321 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 322 | def initHtmlForWiki(){ |
| 323 | wikiContents = ''' |
| 324 | <table class="wrapped confluenceTable"> |
| 325 | <colgroup> |
| 326 | <col /> |
| 327 | <col /> |
| 328 | <col /> |
| 329 | <col /> |
| 330 | <col /> |
| 331 | <col /> |
| 332 | </colgroup> |
| 333 | <tbody> |
| 334 | <tr> |
| 335 | <th colspan="1" class="confluenceTh"> |
| 336 | <br /> |
| 337 | </th> |
| 338 | <th class="confluenceTh"><p>Monday</p></th> |
| 339 | <th class="confluenceTh"><p>Tuesday</p></th> |
| 340 | <th class="confluenceTh"><p>Wednesday</p></th> |
| 341 | <th class="confluenceTh"><p>Thursday</p></th> |
| 342 | <th class="confluenceTh"><p>Friday</p></th> |
| 343 | <th class="confluenceTh"><p>Saturday</p></th> |
| 344 | <th class="confluenceTh"><p>Sunday</p></th> |
| 345 | </tr>''' |
| 346 | for( String test in testcases.keySet() ){ |
| 347 | testcases[ test ][ 'wikiContent' ] = ''' |
| 348 | <tr> |
| 349 | <th colspan="1" class="confluenceTh">''' + test + '''</th>''' |
| 350 | } |
| 351 | } |
| 352 | def addingHeader( testCategory ){ |
| 353 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 354 | <td class="confluenceTd"> |
| 355 | <ul>''' |
| 356 | } |
| 357 | def makeHtmlColList( testCategory, testName ){ |
| 358 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 359 | <li>'''+ testName +'''</li>''' |
| 360 | |
| 361 | } |
| 362 | def closingHeader( testCategory ){ |
| 363 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 364 | </ul> |
| 365 | </td>''' |
| 366 | } |
| 367 | def closeHtmlForWiki(){ |
| 368 | for( String test in testcases.keySet() ){ |
| 369 | wikiContents += testcases[ test ][ 'wikiContent' ] |
| 370 | wikiContents += ''' |
| 371 | </tr>''' |
| 372 | } |
| 373 | wikiContents += ''' |
| 374 | </tbody> |
| 375 | </table> |
Devin Lim | b6f92de | 2018-04-13 18:27:33 -0700 | [diff] [blame] | 376 | <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every supported branch.</p> |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 377 | <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p> |
| 378 | <p>On <strong>Saturdays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( previous_version ) +''' branch.</p> |
| 379 | <p>On <strong>Sundays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( before_previous_version ) +''' branch.</p>''' |
| 380 | } |
| 381 | def postToWiki( contents ){ |
| 382 | node( testMachine ){ |
| 383 | workspace = "/var/jenkins/workspace/all-pipeline-trigger/" |
| 384 | filename = "jenkinsSchedule.txt" |
| 385 | writeFile file: workspace + filename, text: contents |
| 386 | funcs.publishToConfluence( "false", "true", |
| 387 | "Automated Test Schedule", |
| 388 | workspace + filename ) |
| 389 | } |
| 390 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 391 | def dayAdder( testCat, testName, dayOfWeek ){ |
| 392 | AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + "," |
Devin Lim | 41f087a | 2018-03-27 12:28:08 -0700 | [diff] [blame] | 393 | } |