ktesting: doc updates and fixes
First-in-first-out is wrong for cleanup, it's LIFO. Updated some comments to make them more informative and fixed indention.
This commit is contained in:
		@@ -119,7 +119,8 @@ func buildDescription(explain ...interface{}) string {
 | 
			
		||||
//
 | 
			
		||||
//	cb := func(func(tCtx ktesting.TContext) int {
 | 
			
		||||
//	    value, err := doSomething(...)
 | 
			
		||||
//	   ktesting.ExpectNoError(tCtx, err, "something failed")
 | 
			
		||||
//	    tCtx.ExpectNoError(err, "something failed")
 | 
			
		||||
//	    assert(tCtx, 42, value, "the answer")
 | 
			
		||||
//	    return value
 | 
			
		||||
//	}
 | 
			
		||||
//	tCtx.Eventually(cb).Should(gomega.Equal(42), "should be the answer to everything")
 | 
			
		||||
@@ -145,7 +146,16 @@ func buildDescription(explain ...interface{}) string {
 | 
			
		||||
//	cb := func(func(tCtx ktesting.TContext) int {
 | 
			
		||||
//	    value, err := doSomething(...)
 | 
			
		||||
//	    if errors.Is(err, SomeFinalErr) {
 | 
			
		||||
//	    gomega.StopTrying("permanent failure).Wrap(err).Now()
 | 
			
		||||
//	        // This message completely replaces the normal
 | 
			
		||||
//	        // failure message and thus should include all
 | 
			
		||||
//	        // relevant information.
 | 
			
		||||
//	        //
 | 
			
		||||
//	        // github.com/onsi/gomega/format is a good way
 | 
			
		||||
//	        // to format arbitrary data. It uses indention
 | 
			
		||||
//	        // and falls back to YAML for Kubernetes API
 | 
			
		||||
//	        // structs for readability.
 | 
			
		||||
//	        gomega.StopTrying("permanent failure, last value:\n%s", format.Object(value, 1 /* indent one level */)).
 | 
			
		||||
//	            Wrap(err).Now()
 | 
			
		||||
//	    }
 | 
			
		||||
//	    ktesting.ExpectNoError(tCtx, err, "something failed")
 | 
			
		||||
//	    return value
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,7 @@ type TContext interface {
 | 
			
		||||
	Cancel(cause string)
 | 
			
		||||
 | 
			
		||||
	// Cleanup registers a callback that will get invoked when the test
 | 
			
		||||
	// has finished. Callbacks get invoked in first-in-first-out order.
 | 
			
		||||
	// has finished. Callbacks get invoked in last-in-first-out order (LIFO).
 | 
			
		||||
	//
 | 
			
		||||
	// Beware of context cancellation. The following cleanup code
 | 
			
		||||
	// will use a canceled context, which is not desirable:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user