fix: run the instance handler subtests in parallel too

This commit is contained in:
Julian Sommer
2026-09-01 13:02:46 +10:00
parent a0dfd311b2
commit eccf068a25
7 changed files with 8 additions and 0 deletions
@@ -55,6 +55,7 @@ func TestValidateGetPasswordDataInput(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
err := ValidateGetPasswordDataInput(tt.input)
if tt.wantErr == "" {
require.NoError(t, err)
@@ -23,6 +23,7 @@ func TestModifyInstanceMetadataOptions_RejectsMalformedID(t *testing.T) {
}
for name, in := range cases {
t.Run(name, func(t *testing.T) {
t.Parallel()
_, err := ModifyInstanceMetadataOptions(context.Background(), in, nil, "acct")
require.Error(t, err)
assert.Equal(t, awserrors.ErrorInvalidInstanceIDMalformed, err.Error())
@@ -99,6 +99,7 @@ func TestMonitorInstances_InvalidInput(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
_, err := MonitorInstances(context.Background(), &ec2.MonitorInstancesInput{InstanceIds: tt.ids}, nc, "123456789012")
require.Error(t, err)
assert.Equal(t, tt.want, err.Error())
@@ -124,6 +124,7 @@ func TestRebootInstances_DaemonError(t *testing.T) {
awserrors.ErrorServerInternal,
} {
t.Run(code, func(t *testing.T) {
t.Parallel()
_, nc := startTestNATSServer(t)
instanceID := "i-error"
@@ -196,6 +196,7 @@ func TestParseRunInstances(t *testing.T) {
}
t.Run("MissingKeyNameIsValid", func(t *testing.T) {
t.Parallel()
input := defaults
input.KeyName = nil
assert.NoError(t, ValidateRunInstancesInput(&input))
@@ -203,6 +204,7 @@ func TestParseRunInstances(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
// For validation tests, we can pass nil conn since validation happens before NATS call
response, err := RunInstances(context.Background(), test.input, nil, nil, "123456789012", nil, nil, 1)
@@ -589,6 +589,7 @@ func TestDistributeInstances_PropagatesSGValidationErrors(t *testing.T) {
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
_, nc := startTestNATSServer(t)
statusSub, err := nc.Subscribe("spinifex.node.status", func(msg *nats.Msg) {
@@ -45,6 +45,7 @@ func TestNewStateChange(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := newStateChange(tt.instanceID, tt.currentCode, tt.currentName, tt.prevCode, tt.prevName)
require.NotNil(t, result)