Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestCustomHandleCrash (0.23 sec)

  1. pilot/pkg/util/runtime/runtime_test.go

    )
    
    func TestHandleCrash(t *testing.T) {
    	defer func() {
    		if x := recover(); x != nil {
    			t.Errorf("Expected no panic ")
    		}
    	}()
    
    	defer HandleCrash()
    	panic("test")
    }
    
    func TestCustomHandleCrash(t *testing.T) {
    	ch := make(chan struct{}, 1)
    	defer func() {
    		select {
    		case <-ch:
    			t.Logf("crash handler called")
    		case <-time.After(1 * time.Second):
    			t.Errorf("Custom handler not called")
    		}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 1.1K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/util/runtime/runtime_test.go

    func TestHandleCrash(t *testing.T) {
    	defer func() {
    		if x := recover(); x == nil {
    			t.Errorf("Expected a panic to recover from")
    		}
    	}()
    	defer HandleCrash()
    	panic("Test Panic")
    }
    
    func TestCustomHandleCrash(t *testing.T) {
    	old := PanicHandlers
    	defer func() { PanicHandlers = old }()
    	var result interface{}
    	PanicHandlers = []func(context.Context, interface{}){
    		func(_ context.Context, r interface{}) {
    			result = r
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 26 16:28:45 UTC 2024
    - 4.5K bytes
    - Viewed (0)
Back to top