Skip to content

Commit 1139ef8

Browse files
committed
lint
1 parent a18995c commit 1139ef8

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

internal/fleet/agent_policy_resource_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fleet_test
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"testing"
78

@@ -139,7 +140,7 @@ func checkResourceAgentPolicyDestroy(s *terraform.State) error {
139140
}
140141
packagePolicy, diag := fleet.ReadAgentPolicy(context.Background(), fleetClient, rs.Primary.ID)
141142
if diag.HasError() {
142-
return fmt.Errorf(diag[0].Summary)
143+
return errors.New(diag[0].Summary)
143144
}
144145
if packagePolicy != nil {
145146
return fmt.Errorf("agent policy id=%v still exists, but it should have been removed", rs.Primary.ID)
@@ -165,14 +166,14 @@ func checkResourceAgentPolicySkipDestroy(s *terraform.State) error {
165166
}
166167
packagePolicy, diag := fleet.ReadAgentPolicy(context.Background(), fleetClient, rs.Primary.ID)
167168
if diag.HasError() {
168-
return fmt.Errorf(diag[0].Summary)
169+
return errors.New(diag[0].Summary)
169170
}
170171
if packagePolicy == nil {
171172
return fmt.Errorf("agent policy id=%v does not exist, but should still exist when skip_destroy is true", rs.Primary.ID)
172173
}
173174

174175
if diag = fleet.DeleteAgentPolicy(context.Background(), fleetClient, rs.Primary.ID); diag.HasError() {
175-
return fmt.Errorf(diag[0].Summary)
176+
return errors.New(diag[0].Summary)
176177
}
177178
}
178179
return nil

internal/fleet/fleet_server_host_resource_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fleet_test
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"testing"
78

@@ -103,7 +104,7 @@ func checkResourceFleetServerHostDestroy(s *terraform.State) error {
103104
}
104105
packagePolicy, diag := fleet.ReadFleetServerHost(context.Background(), fleetClient, rs.Primary.ID)
105106
if diag.HasError() {
106-
return fmt.Errorf(diag[0].Summary)
107+
return errors.New(diag[0].Summary)
107108
}
108109
if packagePolicy != nil {
109110
return fmt.Errorf("FleetServerHost id=%v still exists, but it should have been removed", rs.Primary.ID)

internal/fleet/integration_policy_resource_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fleet_test
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"testing"
78

@@ -72,15 +73,15 @@ func checkResourceIntegrationPolicyDestroy(s *terraform.State) error {
7273
case "elasticstack_fleet_integration_policy":
7374
integrationPolicy, diag := fleet.ReadPackagePolicy(context.Background(), fleetClient, rs.Primary.ID)
7475
if diag.HasError() {
75-
return fmt.Errorf(diag[0].Summary)
76+
return errors.New(diag[0].Summary)
7677
}
7778
if integrationPolicy != nil {
7879
return fmt.Errorf("integration policy id=%v still exists, but it should have been removed", rs.Primary.ID)
7980
}
8081
case "elasticstack_fleet_agent_policy":
8182
agentPolicy, diag := fleet.ReadAgentPolicy(context.Background(), fleetClient, rs.Primary.ID)
8283
if diag.HasError() {
83-
return fmt.Errorf(diag[0].Summary)
84+
return errors.New(diag[0].Summary)
8485
}
8586
if agentPolicy != nil {
8687
return fmt.Errorf("agent policy id=%v still exists, but it should have been removed", rs.Primary.ID)
@@ -134,7 +135,7 @@ resource "elasticstack_fleet_integration_policy" "test_policy" {
134135
"enabled": true,
135136
"vars": {
136137
"listen_address": "localhost",
137-
"listen_port": 8080,
138+
"listen_port": 8080,
138139
"data_stream.dataset": "tcp.generic",
139140
"tags": [],
140141
"syslog_options": "field: message\n#format: auto\n#timezone: Local\n",
@@ -189,7 +190,7 @@ resource "elasticstack_fleet_integration_policy" "test_policy" {
189190
"enabled": true,
190191
"vars": {
191192
"listen_address": "localhost",
192-
"listen_port": 8085,
193+
"listen_port": 8085,
193194
"data_stream.dataset": "tcp.generic",
194195
"tags": [],
195196
"syslog_options": "field: message\n#format: auto\n#timezone: Local\n",

internal/fleet/output_resource_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fleet_test
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"testing"
78

@@ -226,7 +227,7 @@ func checkResourceOutputDestroy(s *terraform.State) error {
226227
}
227228
packagePolicy, diag := fleet.ReadOutput(context.Background(), fleetClient, rs.Primary.ID)
228229
if diag.HasError() {
229-
return fmt.Errorf(diag[0].Summary)
230+
return errors.New(diag[0].Summary)
230231
}
231232
if packagePolicy != nil {
232233
return fmt.Errorf("output id=%v still exists, but it should have been removed", rs.Primary.ID)

0 commit comments

Comments
 (0)