Fix panic in k8s loadIngresses
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
be362f0d9f
commit
5a67d0ac84
5 changed files with 29 additions and 5 deletions
|
@ -1,11 +1,22 @@
|
|||
package safe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cenk/backoff"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOperationWithRecover(t *testing.T) {
|
||||
operation := func() error {
|
||||
return nil
|
||||
}
|
||||
err := backoff.Retry(OperationWithRecover(operation), &backoff.StopBackOff{})
|
||||
if err != nil {
|
||||
t.Fatalf("Error in OperationWithRecover: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperationWithRecoverPanic(t *testing.T) {
|
||||
operation := func() error {
|
||||
panic("BOOM")
|
||||
}
|
||||
|
@ -14,3 +25,13 @@ func TestOperationWithRecover(t *testing.T) {
|
|||
t.Fatalf("Error in OperationWithRecover: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperationWithRecoverError(t *testing.T) {
|
||||
operation := func() error {
|
||||
return fmt.Errorf("ERROR")
|
||||
}
|
||||
err := backoff.Retry(OperationWithRecover(operation), &backoff.StopBackOff{})
|
||||
if err == nil {
|
||||
t.Fatalf("Error in OperationWithRecover: %s", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue