File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ type Result struct {
3232	RequeueAfter  time.Duration 
3333}
3434
35+ // IsZero returns true if this result is empty. 
36+ func  (r  Result ) IsZero () bool  {
37+ 	return  r  ==  Result {}
38+ }
39+ 
3540// Request contains the information necessary to reconcile a Kubernetes object.  This includes the 
3641// information to uniquely identify the object - its Name and Namespace.  It does NOT contain information about 
3742// any specific Event or the object contents itself. 
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package reconcile_test
1818
1919import  (
2020	"fmt" 
21+ 	"time" 
2122
2223	. "github.com/onsi/ginkgo" 
2324	. "github.com/onsi/gomega" 
@@ -26,6 +27,25 @@ import (
2627)
2728
2829var  _  =  Describe ("reconcile" , func () {
30+ 	Describe ("Result" , func () {
31+ 		It ("IsZero should return true if empty" , func () {
32+ 			res  :=  & reconcile.Result {}
33+ 			Expect (res .IsZero ()).To (BeTrue ())
34+ 			res2  :=  reconcile.Result {}
35+ 			Expect (res2 .IsZero ()).To (BeTrue ())
36+ 		})
37+ 
38+ 		It ("IsZero should return false if Requeue is set to true" , func () {
39+ 			res  :=  reconcile.Result {Requeue : true }
40+ 			Expect (res .IsZero ()).To (BeFalse ())
41+ 		})
42+ 
43+ 		It ("IsZero should return false if RequeueAfter is set to true" , func () {
44+ 			res  :=  reconcile.Result {RequeueAfter : 1  *  time .Second }
45+ 			Expect (res .IsZero ()).To (BeFalse ())
46+ 		})
47+ 	})
48+ 
2949	Describe ("Func" , func () {
3050		It ("should call the function with the request and return a nil error." , func () {
3151			request  :=  reconcile.Request {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments