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

Function TestShouldRetrySSH

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

Source from the content-addressed store, hash-verified

557}
558
559func 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
587func TestErrPersistentAuthFailure(t *testing.T) {
588 t.Run("errors.Is works with ErrPersistentAuthFailure", func(t *testing.T) {

Callers

nothing calls this directly

Calls 1

shouldRetrySSHFunction · 0.85

Tested by

no test coverage detected