Skip to content

Commit b22cee2

Browse files
committed
lint
1 parent 8fe8bc1 commit b22cee2

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

internal/provider/profiles_warehouse_resource.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ func (r *profilesWarehouseResource) Create(ctx context.Context, req resource.Cre
145145
return
146146
}
147147

148-
// This is to satisfy terraform requirements that the returned fields must match the input ones because new settings can be generated in the response
148+
// This is to satisfy terraform requirements that the returned fields must match the input ones because new settings can be generated in the response.
149149
state.Settings = plan.Settings
150150

151-
// Set state to fully populated data
151+
// Set state to fully populated data.
152152
diags = resp.State.Set(ctx, state)
153153
resp.Diagnostics.Append(diags...)
154154
if resp.Diagnostics.HasError() {
@@ -229,7 +229,7 @@ func (r *profilesWarehouseResource) Update(ctx context.Context, req resource.Upd
229229
return
230230
}
231231

232-
// Only send schemaName to API if it differs from the remote state
232+
// Only send schemaName to API if it differs from the remote state.
233233
// This prevents API failures when the schema name already exists in the warehouse.
234234
// The Segment API fails if we send a schemaName that matches the current configuration,
235235
// even though it should be a no-op. This handles all cases:
@@ -269,7 +269,7 @@ func (r *profilesWarehouseResource) Update(ctx context.Context, req resource.Upd
269269
return
270270
}
271271

272-
// This is to satisfy terraform requirements that the returned fields must match the input ones because new settings can be generated in the response
272+
// This is to satisfy terraform requirements that the returned fields must match the input ones because new settings can be generated in the response.
273273
state.Settings = plan.Settings
274274

275275
diags = resp.State.Set(ctx, &state)

internal/provider/profiles_warehouse_resource_test.go

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func TestAccProfilesWarehouseResource(t *testing.T) {
162162
resource.Test(t, resource.TestCase{
163163
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
164164
Steps: []resource.TestStep{
165-
// Create and Read testing
165+
// Create and Read testing.
166166
{
167167
Config: providerConfig + `
168168
resource "segment_profiles_warehouse" "test" {
@@ -186,7 +186,7 @@ func TestAccProfilesWarehouseResource(t *testing.T) {
186186
resource.TestCheckResourceAttr("segment_profiles_warehouse.test", "schema_name", "my-schema-name"),
187187
),
188188
},
189-
// ImportState testing
189+
// ImportState testing.
190190
{
191191
ResourceName: "segment_profiles_warehouse.test",
192192
Config: providerConfig + `
@@ -204,7 +204,7 @@ func TestAccProfilesWarehouseResource(t *testing.T) {
204204
ImportState: true,
205205
ImportStateId: "my-space-id:my-warehouse-id",
206206
},
207-
// Update and Read testing
207+
// Update and Read testing.
208208
{
209209
Config: providerConfig + `
210210
resource "segment_profiles_warehouse" "test" {
@@ -227,14 +227,14 @@ func TestAccProfilesWarehouseResource(t *testing.T) {
227227
resource.TestCheckResourceAttr("segment_profiles_warehouse.test", "settings", "{\"token\":\"my-other-token\"}"),
228228
resource.TestCheckResourceAttr("segment_profiles_warehouse.test", "schema_name", "my-new-schema-name")),
229229
},
230-
// Delete testing automatically occurs in TestCase
230+
// Delete testing automatically occurs in TestCase.
231231
},
232232
})
233233
}
234234

235235
func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
236236
// Test the schemaName handling that prevents API failures when the schema
237-
// name already exists in the warehouse configuration
237+
// name already exists in the warehouse configuration.
238238
t.Parallel()
239239

240240
updateCount := 0
@@ -244,7 +244,7 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
244244

245245
payload := ""
246246
if req.URL.Path == "/spaces/my-space-id/profiles-warehouses" && req.Method == http.MethodPost {
247-
// Initial create response
247+
// Initial create response.
248248
payload = `
249249
{
250250
"data": {
@@ -275,7 +275,7 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
275275
}
276276
`
277277
} else if req.URL.Path == "/spaces/my-space-id/profiles-warehouses/my-warehouse-id" && req.Method == http.MethodPatch {
278-
// Update response - schemaName should only be sent when it changes
278+
// Update response - schemaName should only be sent when it changes.
279279
updateCount++
280280
payload = `
281281
{
@@ -307,7 +307,7 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
307307
}
308308
`
309309
} else if req.URL.Path == "/spaces/my-space-id/profiles-warehouses" && req.Method == http.MethodGet {
310-
// Read response
310+
// Read response.
311311
payload = `
312312
{
313313
"data": {
@@ -356,7 +356,7 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
356356
resource.Test(t, resource.TestCase{
357357
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
358358
Steps: []resource.TestStep{
359-
// Create with schema_name
359+
// Create with schema_name.
360360
{
361361
Config: providerConfig + `
362362
resource "segment_profiles_warehouse" "test" {
@@ -374,7 +374,7 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
374374
resource.TestCheckResourceAttr("segment_profiles_warehouse.test", "schema_name", "my-schema-name"),
375375
),
376376
},
377-
// Update with same schema_name - should not send schemaName to API (prevents API failure)
377+
// Update with same schema_name - should not send schemaName to API (prevents API failure).
378378
{
379379
Config: providerConfig + `
380380
resource "segment_profiles_warehouse" "test" {
@@ -392,7 +392,7 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
392392
resource.TestCheckResourceAttr("segment_profiles_warehouse.test", "schema_name", "my-schema-name"),
393393
),
394394
},
395-
// Update with different schema_name - should send schemaName to API (legitimate change)
395+
// Update with different schema_name - should send schemaName to API (legitimate change).
396396
{
397397
Config: providerConfig + `
398398
resource "segment_profiles_warehouse" "test" {
@@ -415,6 +415,8 @@ func TestAccProfilesWarehouseResource_SchemaNameHandling(t *testing.T) {
415415
}
416416

417417
func TestDetermineSchemaNameForUpdate(t *testing.T) {
418+
t.Parallel()
419+
418420
// Test the determineSchemaNameForUpdate function that prevents API failures
419421
// when the schema name already exists in the warehouse configuration.
420422
tests := []struct {
@@ -498,7 +500,9 @@ func TestDetermineSchemaNameForUpdate(t *testing.T) {
498500

499501
for _, tt := range tests {
500502
t.Run(tt.name, func(t *testing.T) {
501-
// Test the actual function
503+
t.Parallel()
504+
505+
// Test the actual function.
502506
result := determineSchemaNameForUpdate(tt.planSchemaName, tt.stateSchemaName)
503507

504508
// Check if the result matches expected.

0 commit comments

Comments
 (0)