mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #4569 from a-robinson/e2e-times
Fix the e2e --times flag for running tests more than once
This commit is contained in:
		@@ -17,6 +17,7 @@ limitations under the License.
 | 
				
			|||||||
package e2e
 | 
					package e2e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
	"path"
 | 
						"path"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
@@ -63,19 +64,18 @@ func RunE2ETests(authConfig, certDir, host, repoRoot, provider string, orderseed
 | 
				
			|||||||
		config.GinkgoConfig.FocusString = `\b(` + strings.Join(testRegexps, "|") + `)\b`
 | 
							config.GinkgoConfig.FocusString = `\b(` + strings.Join(testRegexps, "|") + `)\b`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: Make "times" work again.
 | 
					 | 
				
			||||||
	// TODO: Make orderseed work again.
 | 
						// TODO: Make orderseed work again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var passed testResult = true
 | 
						var passed testResult = true
 | 
				
			||||||
	gomega.RegisterFailHandler(ginkgo.Fail)
 | 
						gomega.RegisterFailHandler(ginkgo.Fail)
 | 
				
			||||||
 | 
						// Run the existing tests with output to console + JUnit for Jenkins
 | 
				
			||||||
 | 
						for i := 0; i < times && passed; i++ {
 | 
				
			||||||
		var r []ginkgo.Reporter
 | 
							var r []ginkgo.Reporter
 | 
				
			||||||
		if reportDir != "" {
 | 
							if reportDir != "" {
 | 
				
			||||||
		// TODO: When we start using parallel tests we need to change this to "junit_%d.xml",
 | 
								r = append(r, reporters.NewJUnitReporter(path.Join(reportDir, fmt.Sprintf("junit_%d.xml", i+1))))
 | 
				
			||||||
		// see ginkgo docs for more details.
 | 
							}
 | 
				
			||||||
		r = append(r, reporters.NewJUnitReporter(path.Join(reportDir, "junit.xml")))
 | 
							ginkgo.RunSpecsWithDefaultAndCustomReporters(&passed, fmt.Sprintf("Kubernetes e2e Suite run %d of %d", i+1, times), r)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Run the existing tests with output to console + JUnit for Jenkins
 | 
					 | 
				
			||||||
	ginkgo.RunSpecsWithDefaultAndCustomReporters(&passed, "Kubernetes e2e Suite", r)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !passed {
 | 
						if !passed {
 | 
				
			||||||
		glog.Fatalf("At least one test failed")
 | 
							glog.Fatalf("At least one test failed")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user