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