Merge pull request #105939 from NikhilSharmaWe/betterOutputFramework

Changed code to improve output for files under test/e2e/framework
This commit is contained in:
Kubernetes Prow Robot 2021-11-03 08:05:06 -07:00 committed by GitHub
commit 16c86404dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -75,7 +75,9 @@ func (p *Provider) FrameworkBeforeEach(f *framework.Framework) {
p.controller, err = kubemark.NewKubemarkController(externalClient, externalInformerFactory, f.ClientSet, kubemarkNodeInformer)
framework.ExpectNoError(err)
externalInformerFactory.Start(p.closeChannel)
framework.ExpectEqual(p.controller.WaitForCacheSync(p.closeChannel), true)
if !p.controller.WaitForCacheSync(p.closeChannel) {
framework.Failf("Unable to sync caches for %v", p.controller)
}
go p.controller.Run(p.closeChannel)
}
}

View File

@ -1377,7 +1377,7 @@ retriesLoop:
// NOTE the test may need access to the events to see what's going on, such as a change in status
actualWatchEvents := scenario(resourceWatch)
errs := sets.NewString()
ExpectEqual(len(expectedWatchEvents) <= len(actualWatchEvents), true, "Error: actual watch events amount (%d) must be greater than or equal to expected watch events amount (%d)", len(actualWatchEvents), len(expectedWatchEvents))
gomega.Expect(len(expectedWatchEvents)).To(gomega.BeNumerically("<=", len(actualWatchEvents)), "Did not get enough watch events")
totalValidWatchEvents := 0
foundEventIndexes := map[int]*int{}
@ -1406,7 +1406,9 @@ retriesLoop:
fmt.Println("invariants violated:\n", strings.Join(errs.List(), "\n - "))
continue retriesLoop
}
ExpectEqual(errs.Len() > 0, false, strings.Join(errs.List(), "\n - "))
if errs.Len() > 0 {
Failf("Unexpected error(s): %v", strings.Join(errs.List(), "\n - "))
}
ExpectEqual(totalValidWatchEvents, len(expectedWatchEvents), "Error: there must be an equal amount of total valid watch events (%d) and expected watch events (%d)", totalValidWatchEvents, len(expectedWatchEvents))
break retriesLoop
}