Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 1 | #!groovy |
| 2 | |
Devin Lim | fc4f22c | 2018-03-23 18:18:27 -0700 | [diff] [blame] | 3 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' ) |
| 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' ) |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame^] | 6 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 7 | |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame^] | 8 | fileRelated.init() |
You Wang | 9af1648 | 2018-05-02 13:45:28 -0700 | [diff] [blame] | 9 | current_version = "master" |
| 10 | previous_version = "1.13" |
| 11 | before_previous_version = "1.12" |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 12 | funcs.initializeTrend( "Fabric" ); |
| 13 | funcs.initialize( "Fabric" ) |
| 14 | triggerFuncs.init( funcs ) |
| 15 | |
| 16 | wikiContents = "" |
| 17 | testcases = [ |
| 18 | "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ], |
| 19 | "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ], |
| 20 | "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ], |
Devin Lim | 86e4053 | 2018-04-06 12:44:06 -0700 | [diff] [blame] | 21 | "SR" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ], |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 22 | "SR1" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ], |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 23 | "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ] |
| 24 | ] |
| 25 | Prefix_organizer = [ |
| 26 | "FU" : "FUNC", |
| 27 | "HA" : "HA", |
| 28 | "PL" : "USECASE", |
| 29 | "SA" : "USECASE", |
| 30 | "SC" : "SCPF", |
| 31 | "SR" : "SR", |
| 32 | "US" : "USECASE", |
| 33 | "VP" : "USECASE" |
| 34 | ] |
| 35 | |
| 36 | manually_run = params.manual_run |
Devin Lim | b6f92de | 2018-04-13 18:27:33 -0700 | [diff] [blame] | 37 | onos_b = current_version |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 38 | test_branch = "" |
| 39 | onos_tag = params.ONOSTag |
| 40 | isOldFlow = true |
| 41 | |
| 42 | // Set tests based on day of week |
| 43 | def now = funcs.getCurrentTime() |
| 44 | print now.toString() |
| 45 | today = now[ Calendar.DAY_OF_WEEK ] |
| 46 | |
| 47 | if ( manually_run ){ |
| 48 | onos_b = params.ONOSVersion |
| 49 | } |
| 50 | AllTheTests = test_lists.getAllTheTests( onos_b ) |
| 51 | |
| 52 | day = "" |
| 53 | SCPF_choices = "" |
| 54 | USECASE_choices = "" |
| 55 | FUNC_choices = "" |
| 56 | HA_choices = "" |
| 57 | SR_choices = "" |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame^] | 58 | stat_graph_generator_file = fileRelated.histogramMultiple |
| 59 | pie_graph_generator_file = fileRelated.pieMultiple |
| 60 | graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric/" |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 61 | |
| 62 | post_result = params.PostResult |
| 63 | if( !manually_run ){ |
Devin Lim | 33fe4e7 | 2018-04-06 19:45:53 -0700 | [diff] [blame] | 64 | slackSend( channel:'sr-failures', color:'#03CD9F', |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 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:" ) |
| 68 | |
| 69 | SR_choices += adder( "SR", "basic", true ) |
Devin Lim | be48307 | 2018-03-24 14:37:48 -0700 | [diff] [blame] | 70 | if ( today == Calendar.FRIDAY ){ |
| 71 | SR_choices += adder( "SR", "extra_A", true ) |
| 72 | } else if( today == Calendar.SATURDAY ){ |
| 73 | SR_choices += adder( "SR", "extra_B", true ) |
| 74 | } |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 75 | SR_choices = triggerFuncs.lastCommaRemover( SR_choices ) |
| 76 | } |
| 77 | if ( manually_run ){ |
| 78 | testcases = triggerFuncs.organize_tests( params.Tests, testcases ) |
| 79 | |
| 80 | isOldFlow = params.isOldFlow |
| 81 | println "Tests to be run manually : " |
| 82 | }else{ |
| 83 | testcases[ "SR" ][ "tests" ] = SR_choices |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 84 | testcases[ "SR1" ][ "tests" ] = SR_choices |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 85 | println "Defaulting to " + day + " tests:" |
| 86 | } |
| 87 | |
| 88 | triggerFuncs.print_tests( testcases ) |
| 89 | |
| 90 | def runTest = [ |
Devin Lim | 86e4053 | 2018-04-06 12:44:06 -0700 | [diff] [blame] | 91 | "Fabric2" : [:], |
| 92 | "Fabric3" : [:] |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 93 | ] |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 94 | if ( manually_run ){ |
| 95 | for( String test in testcases.keySet() ){ |
| 96 | println test |
| 97 | if ( testcases[ test ][ "tests" ] != "" ){ |
| 98 | runTest[ testcases[ test ][ "nodeName" ][ nodeOn( onos_b ) ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ][ nodeOn( onos_b ) ], test, manually_run, onos_tag ) |
| 99 | } |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 100 | } |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 101 | }else{ |
Devin Lim | 0c25f2f | 2018-05-10 15:43:09 -0700 | [diff] [blame] | 102 | runTest[ "Fabric2" ][ "SR1" ] = triggerFuncs.trigger_pipeline( current_version, testcases[ "SR1" ][ "tests" ], testcases[ "SR1" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 103 | runTest[ "Fabric2" ][ "SR" ] = triggerFuncs.trigger_pipeline( previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag ) |
| 104 | runTest[ "Fabric3" ][ "SR" ] = triggerFuncs.trigger_pipeline( before_previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 1 ], "SR", manually_run, onos_tag ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 105 | } |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 106 | |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 107 | def finalList = [:] |
Devin Lim | 86e4053 | 2018-04-06 12:44:06 -0700 | [diff] [blame] | 108 | finalList[ "Fabric2" ] = triggerFuncs.runTestSeq( runTest[ "Fabric2" ] ) |
| 109 | finalList[ "Fabric3" ] = triggerFuncs.runTestSeq( runTest[ "Fabric3" ] ) |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 110 | parallel finalList |
| 111 | /* |
| 112 | if ( !manually_run ){ |
Devin Lim | 86e4053 | 2018-04-06 12:44:06 -0700 | [diff] [blame] | 113 | funcs.generateStatGraph( "TestStation-Fabric2s", |
| 114 | funcs.branchWithPrefix( "master" ), |
| 115 | AllTheTests, |
| 116 | stat_graph_generator_file, |
| 117 | pie_graph_generator_file, |
| 118 | graph_saved_directory ) |
| 119 | funcs.generateStatGraph( "TestStation-Fabric3s", |
| 120 | funcs.branchWithPrefix( "1.12" ), |
Devin Lim | 431408d | 2018-03-23 17:51:31 -0700 | [diff] [blame] | 121 | AllTheTests, |
| 122 | stat_graph_generator_file, |
| 123 | pie_graph_generator_file, |
| 124 | graph_saved_directory ) |
| 125 | }*/ |
| 126 | def adder( testCat, set, getResult ){ |
| 127 | result = "" |
| 128 | for( String test in AllTheTests[ testCat ].keySet() ){ |
| 129 | if( AllTheTests[ testCat ][ test ][ set ] ){ |
| 130 | if( getResult ) |
| 131 | result += test + "," |
| 132 | } |
| 133 | } |
| 134 | return result |
Devin Lim | b6f92de | 2018-04-13 18:27:33 -0700 | [diff] [blame] | 135 | } |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 136 | def nodeOn( branch ){ |
| 137 | return branch == "1.12" ? 1 : 0; |
Devin Lim | 0c25f2f | 2018-05-10 15:43:09 -0700 | [diff] [blame] | 138 | } |