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