Skip to content

Commit 369ee7d

Browse files
authored
fix(BREV-1713): Shadeform Tests -- Run Validate and Terminate Sequentially (#47)
* run validate and terminate sequentially * use faster instance type
1 parent 2e017f4 commit 369ee7d

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

internal/ssh/ssh.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func ConnectToHost(ctx context.Context, config ConnectionConfig) (*Client, error
3131
dial: d.DialContext,
3232
privateKey: config.PrivKey,
3333
}
34-
fmt.Printf("local_ip: %s, public_ip: %s\n", localIP, publicIP)
34+
fmt.Printf("local_ip: %s, public_ip: %s\n", localIP, publicIP) // TODO: use logger
3535
err := sshClient.Connect(ctx)
3636
if err != nil {
3737
return nil, fmt.Errorf("failed to connect: %w", err)
@@ -242,19 +242,19 @@ func StartTestSSHServer(options TestSSHServerOptions) (func() error, error) {
242242
authorizedKey := gossh.MarshalAuthorizedKey(s.PublicKey())
243243
_, err := io.WriteString(s, fmt.Sprintf("public key used by %s:\n", s.User())) // writes to client output
244244
if err != nil {
245-
fmt.Println(err)
245+
fmt.Println(err) // TODO: use logger
246246
}
247247
_, err = s.Write(authorizedKey)
248248
if err != nil {
249-
fmt.Println(err)
249+
fmt.Println(err) // TODO: use logger
250250
}
251251
_, err = s.Write([]byte(s.RawCommand()))
252252
if err != nil {
253-
fmt.Println(err)
253+
fmt.Println(err) // TODO: use logger
254254
}
255255
err = s.Exit(options.ExitCode)
256256
if err != nil {
257-
fmt.Println(err)
257+
fmt.Println(err) // TODO: use logger
258258
}
259259
}
260260

@@ -275,7 +275,7 @@ func StartTestSSHServer(options TestSSHServerOptions) (func() error, error) {
275275
go func() {
276276
err1 := server.ListenAndServe()
277277
if err1 != nil {
278-
fmt.Println(err1)
278+
fmt.Println(err1) // TODO: use logger
279279
}
280280
}()
281281
time.Sleep(100 * time.Millisecond)
@@ -377,7 +377,7 @@ func TrySSHConnect(ctx context.Context, c ConnectionConfig, options WaitForSSHOp
377377
defer func() {
378378
if closeErr := con.Close(); closeErr != nil {
379379
// Log close error but don't return it as it's not the primary error
380-
fmt.Printf("warning: failed to close SSH connection: %v\n", closeErr)
380+
fmt.Printf("warning: failed to close SSH connection: %v\n", closeErr) // TODO: use logger
381381
}
382382
}()
383383
_, _, err = con.RunCommand(ctx, options.CheckCmd)

v1/providers/shadeform/validation_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func TestInstanceLifecycleValidation(t *testing.T) {
4040
}
4141

4242
func TestInstanceTypeFilter(t *testing.T) {
43-
t.Parallel()
4443
checkSkip(t)
4544
apiKey := getAPIKey()
4645

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

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

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

117115
t.Run("ValidateTerminateInstance", func(t *testing.T) {
118-
t.Parallel()
119116
err := v1.ValidateTerminateInstance(ctx, client, instance)
120117
require.NoError(t, err, "ValidateTerminateInstance should pass")
121118
})

0 commit comments

Comments
 (0)