Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions internal/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func ConnectToHost(ctx context.Context, config ConnectionConfig) (*Client, error
dial: d.DialContext,
privateKey: config.PrivKey,
}
fmt.Printf("local_ip: %s, public_ip: %s\n", localIP, publicIP)
fmt.Printf("local_ip: %s, public_ip: %s\n", localIP, publicIP) // TODO: use logger
err := sshClient.Connect(ctx)
if err != nil {
return nil, fmt.Errorf("failed to connect: %w", err)
Expand Down Expand Up @@ -242,19 +242,19 @@ func StartTestSSHServer(options TestSSHServerOptions) (func() error, error) {
authorizedKey := gossh.MarshalAuthorizedKey(s.PublicKey())
_, err := io.WriteString(s, fmt.Sprintf("public key used by %s:\n", s.User())) // writes to client output
if err != nil {
fmt.Println(err)
fmt.Println(err) // TODO: use logger
}
_, err = s.Write(authorizedKey)
if err != nil {
fmt.Println(err)
fmt.Println(err) // TODO: use logger
}
_, err = s.Write([]byte(s.RawCommand()))
if err != nil {
fmt.Println(err)
fmt.Println(err) // TODO: use logger
}
err = s.Exit(options.ExitCode)
if err != nil {
fmt.Println(err)
fmt.Println(err) // TODO: use logger
}
}

Expand All @@ -275,7 +275,7 @@ func StartTestSSHServer(options TestSSHServerOptions) (func() error, error) {
go func() {
err1 := server.ListenAndServe()
if err1 != nil {
fmt.Println(err1)
fmt.Println(err1) // TODO: use logger
}
}()
time.Sleep(100 * time.Millisecond)
Expand Down Expand Up @@ -377,7 +377,7 @@ func TrySSHConnect(ctx context.Context, c ConnectionConfig, options WaitForSSHOp
defer func() {
if closeErr := con.Close(); closeErr != nil {
// Log close error but don't return it as it's not the primary error
fmt.Printf("warning: failed to close SSH connection: %v\n", closeErr)
fmt.Printf("warning: failed to close SSH connection: %v\n", closeErr) // TODO: use logger
}
}()
_, _, err = con.RunCommand(ctx, options.CheckCmd)
Expand Down
9 changes: 3 additions & 6 deletions v1/providers/shadeform/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestInstanceLifecycleValidation(t *testing.T) {
}

func TestInstanceTypeFilter(t *testing.T) {
t.Parallel()
checkSkip(t)
apiKey := getAPIKey()

Expand All @@ -50,8 +49,8 @@ func TestInstanceTypeFilter(t *testing.T) {
client := NewShadeformClient("validation-test", apiKey)
client.WithConfiguration(Configuration{
AllowedInstanceTypes: map[openapi.Cloud]map[string]bool{
openapi.DATACRUNCH: {
"B200": true,
openapi.HYPERSTACK: {
"A4000": true,
},
},
})
Expand All @@ -60,7 +59,7 @@ func TestInstanceTypeFilter(t *testing.T) {
require.NoError(t, err)
require.NotEmpty(t, types, "Should have instance types")
require.True(t, len(types) == 1, "Instance types should return only one entry")
require.True(t, types[0].Type == "datacrunch_B200", "returned instance type does not match expectations")
require.True(t, types[0].Type == "hyperstack_A4000", "returned instance type does not match expectations")

if !types[0].IsAvailable {
return
Expand Down Expand Up @@ -109,13 +108,11 @@ func TestInstanceTypeFilter(t *testing.T) {
require.NotNil(t, instance)

t.Run("ValidateSSHAccessible", func(t *testing.T) {
t.Parallel()
err := v1.ValidateInstanceSSHAccessible(ctx, client, instance, ssh.GetTestPrivateKey())
require.NoError(t, err, "ValidateSSHAccessible should pass")
})

t.Run("ValidateTerminateInstance", func(t *testing.T) {
t.Parallel()
err := v1.ValidateTerminateInstance(ctx, client, instance)
require.NoError(t, err, "ValidateTerminateInstance should pass")
})
Expand Down
Loading