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