(t *testing.T)
| 557 | } |
| 558 | |
| 559 | func TestShouldRetrySSH(t *testing.T) { |
| 560 | t.Run("nil error", func(t *testing.T) { |
| 561 | assert.False(t, shouldRetrySSH(nil)) |
| 562 | }) |
| 563 | |
| 564 | t.Run("connection closed", func(t *testing.T) { |
| 565 | assert.True(t, shouldRetrySSH(fmt.Errorf("ssh: connection closed"))) |
| 566 | }) |
| 567 | |
| 568 | t.Run("kex exchange issue", func(t *testing.T) { |
| 569 | assert.True(t, shouldRetrySSH(fmt.Errorf("kex_exchange_identification: Connection closed"))) |
| 570 | }) |
| 571 | |
| 572 | t.Run("handshake failed", func(t *testing.T) { |
| 573 | assert.True(t, shouldRetrySSH(fmt.Errorf("ssh: handshake failed"))) |
| 574 | }) |
| 575 | |
| 576 | t.Run("auth errors are retryable", func(t *testing.T) { |
| 577 | // Auth errors are now retried (key may still be propagating to instance) |
| 578 | assert.True(t, shouldRetrySSH(fmt.Errorf("ssh: unable to authenticate"))) |
| 579 | }) |
| 580 | |
| 581 | t.Run("non retryable", func(t *testing.T) { |
| 582 | // Some errors should not be retried |
| 583 | assert.False(t, shouldRetrySSH(fmt.Errorf("some random unrelated error"))) |
| 584 | }) |
| 585 | } |
| 586 | |
| 587 | func TestErrPersistentAuthFailure(t *testing.T) { |
| 588 | t.Run("errors.Is works with ErrPersistentAuthFailure", func(t *testing.T) { |
nothing calls this directly
no test coverage detected