MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / TestTimeout

Function TestTimeout

datagramsession/manager_test.go:111–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestTimeout(t *testing.T) {
112 const (
113 testTimeout = time.Millisecond * 50
114 )
115
116 mg := NewManager(&nopLogger, nil, nil)
117 mg.timeout = testTimeout
118 ctx := context.Background()
119 sessionID := uuid.New()
120 // session manager is not running, so event loop is not running and therefore calling the APIs should timeout
121 session, err := mg.RegisterSession(ctx, sessionID, nil)
122 require.ErrorIs(t, err, context.DeadlineExceeded)
123 require.Nil(t, session)
124
125 err = mg.UnregisterSession(ctx, sessionID, "session gone", true)
126 require.ErrorIs(t, err, context.DeadlineExceeded)
127}
128
129func TestUnregisterSessionCloseSession(t *testing.T) {
130 sessionID := uuid.New()

Callers

nothing calls this directly

Calls 3

RegisterSessionMethod · 0.95
UnregisterSessionMethod · 0.95
NewManagerFunction · 0.85

Tested by

no test coverage detected