Build system, release automation, SDK generation, Ansible executor, LinuxKit dev environments, container runtime, deployment, infra metrics, and developer toolkit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
721 B
Go
36 lines
721 B
Go
package ansible
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewSSHClient(t *testing.T) {
|
|
cfg := SSHConfig{
|
|
Host: "localhost",
|
|
Port: 2222,
|
|
User: "root",
|
|
}
|
|
|
|
client, err := NewSSHClient(cfg)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, client)
|
|
assert.Equal(t, "localhost", client.host)
|
|
assert.Equal(t, 2222, client.port)
|
|
assert.Equal(t, "root", client.user)
|
|
assert.Equal(t, 30*time.Second, client.timeout)
|
|
}
|
|
|
|
func TestSSHConfig_Defaults(t *testing.T) {
|
|
cfg := SSHConfig{
|
|
Host: "localhost",
|
|
}
|
|
|
|
client, err := NewSSHClient(cfg)
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, 22, client.port)
|
|
assert.Equal(t, "root", client.user)
|
|
assert.Equal(t, 30*time.Second, client.timeout)
|
|
}
|