mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Add test timing to TAP output in hack/e2e.go
Found this buried at https://issues.jenkins-ci.org/browse/JENKINS-16647
This commit is contained in:
		
							
								
								
									
										11
									
								
								hack/e2e.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								hack/e2e.go
									
									
									
									
									
								
							@@ -316,14 +316,25 @@ func Test() (results ResultsByTest) {
 | 
				
			|||||||
	for i, name := range toRun {
 | 
						for i, name := range toRun {
 | 
				
			||||||
		absName := filepath.Join(*root, "hack", "e2e-suite", name)
 | 
							absName := filepath.Join(*root, "hack", "e2e-suite", name)
 | 
				
			||||||
		log.Printf("Starting test [%v/%v]: %v", i+1, len(toRun), name)
 | 
							log.Printf("Starting test [%v/%v]: %v", i+1, len(toRun), name)
 | 
				
			||||||
 | 
							start := time.Now()
 | 
				
			||||||
		testResult := results[name]
 | 
							testResult := results[name]
 | 
				
			||||||
		res, stdout, stderr := runBashWithOutputs(name, absName)
 | 
							res, stdout, stderr := runBashWithOutputs(name, absName)
 | 
				
			||||||
 | 
							duration_ms := time.Now().Sub(start).Seconds() * 1000
 | 
				
			||||||
		if res {
 | 
							if res {
 | 
				
			||||||
			fmt.Printf("ok %v - %v\n", i+1, name)
 | 
								fmt.Printf("ok %v - %v\n", i+1, name)
 | 
				
			||||||
 | 
								if *tap {
 | 
				
			||||||
 | 
									fmt.Printf("  ---\n  duration_ms: %.3f\n  ...\n", duration_ms)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			testResult.Pass++
 | 
								testResult.Pass++
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			fmt.Printf("not ok %v - %v\n", i+1, name)
 | 
								fmt.Printf("not ok %v - %v\n", i+1, name)
 | 
				
			||||||
 | 
								if *tap {
 | 
				
			||||||
 | 
									fmt.Printf("  ---\n  duration_ms: %.3f\n", duration_ms)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			printBashOutputs("  ", "    ", stdout, stderr)
 | 
								printBashOutputs("  ", "    ", stdout, stderr)
 | 
				
			||||||
 | 
								if *tap {
 | 
				
			||||||
 | 
									fmt.Printf("  ...\n")
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			testResult.Fail++
 | 
								testResult.Fail++
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		results[name] = testResult
 | 
							results[name] = testResult
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user