MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / TestShouldRetryDial

Function TestShouldRetryDial

utils/ssh_test.go:528–557  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

526func (e *customNetError) Temporary() bool { return e.temporary }
527
528func TestShouldRetryDial(t *testing.T) {
529 t.Run("nil error", func(t *testing.T) {
530 assert.False(t, shouldRetryDial(nil))
531 })
532
533 t.Run("timeout net error", func(t *testing.T) {
534 err := &customNetError{msg: "timeout", timeout: true}
535 assert.True(t, shouldRetryDial(err))
536 })
537
538 t.Run("temporary net error", func(t *testing.T) {
539 assert.True(t, shouldRetryDial(fmt.Errorf("dial tcp 1.2.3.4:22: connection reset by peer")))
540 })
541
542 t.Run("connection refused", func(t *testing.T) {
543 assert.True(t, shouldRetryDial(fmt.Errorf("dial tcp 1.2.3.4:22: connection refused")))
544 })
545
546 t.Run("no route to host", func(t *testing.T) {
547 assert.True(t, shouldRetryDial(fmt.Errorf("dial tcp 1.2.3.4:22: no route to host")))
548 })
549
550 t.Run("operation timed out", func(t *testing.T) {
551 assert.True(t, shouldRetryDial(fmt.Errorf("dial tcp: operation timed out")))
552 })
553
554 t.Run("non retryable", func(t *testing.T) {
555 assert.False(t, shouldRetryDial(fmt.Errorf("ssh: authentication failed")))
556 })
557}
558
559func TestShouldRetrySSH(t *testing.T) {
560 t.Run("nil error", func(t *testing.T) {

Callers

nothing calls this directly

Calls 1

shouldRetryDialFunction · 0.85

Tested by

no test coverage detected