(t *testing.T)
| 526 | func (e *customNetError) Temporary() bool { return e.temporary } |
| 527 | |
| 528 | func 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 | |
| 559 | func TestShouldRetrySSH(t *testing.T) { |
| 560 | t.Run("nil error", func(t *testing.T) { |
nothing calls this directly
no test coverage detected