Skip to content

Commit e867c65

Browse files
committed
Fix lint errors
1 parent e1fe39b commit e867c65

8 files changed

+29
-2
lines changed

internal/provider/destination_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ func (r *destinationResource) Read(ctx context.Context, req resource.ReadRequest
623623
"Unable to merge Destination settings",
624624
err.Error(),
625625
)
626+
626627
return
627628
}
628629
state.Settings = mergedSettings

internal/provider/destination_subscription_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ func (r *destinationSubscriptionResource) Read(ctx context.Context, req resource
263263
"Unable to merge Destination subscription settings",
264264
err.Error(),
265265
)
266+
266267
return
267268
}
268269
state.Settings = mergedSettings

internal/provider/insert_function_instance_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ func (r *insertFunctionInstanceResource) Read(ctx context.Context, req resource.
194194
"Unable to merge Insert Function instance settings",
195195
err.Error(),
196196
)
197+
197198
return
198199
}
199200
state.Settings = mergedSettings

internal/provider/profiles_warehouse_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func (r *profilesWarehouseResource) Read(ctx context.Context, req resource.ReadR
203203
"Unable to merge Profiles Warehouse settings",
204204
err.Error(),
205205
)
206+
206207
return
207208
}
208209
state.Settings = mergedSettings

internal/provider/source_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ func (r *sourceResource) Read(ctx context.Context, req resource.ReadRequest, res
423423
"Unable to merge Source settings",
424424
err.Error(),
425425
)
426+
426427
return
427428
}
428429
state.Settings = mergedSettings

internal/provider/utils.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func getError(err error, body *http.Response) string {
2929
return err.Error() + "\n" + formattedBody.String()
3030
}
3131

32-
// mergeSettings merges config settings with remote settings, preserving only the keys defined in config
32+
// mergeSettings merges config settings with remote settings, preserving only the keys defined in config.
3333
func mergeSettings(configSettings, remoteSettings jsontypes.Normalized, isWarehouse bool) (jsontypes.Normalized, error) {
3434
var configMap map[string]interface{}
3535
if diags := configSettings.Unmarshal(&configMap); diags.HasError() {
@@ -57,5 +57,10 @@ func mergeSettings(configSettings, remoteSettings jsontypes.Normalized, isWareho
5757
}
5858
}
5959

60-
return models.GetSettings(merged)
60+
result, err := models.GetSettings(merged)
61+
if err != nil {
62+
return jsontypes.Normalized{}, fmt.Errorf("failed to merge settings: %s", err.Error())
63+
}
64+
65+
return result, nil
6166
}

internal/provider/utils_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import (
99
)
1010

1111
func TestMergeSettings(t *testing.T) {
12+
t.Parallel()
13+
1214
t.Run("merges config-defined settings with remote values", func(t *testing.T) {
15+
t.Parallel()
1316
configSettings := jsontypes.NewNormalizedValue(`{"key1":"configValue1","key2":"configValue2"}`)
1417
remoteSettings := jsontypes.NewNormalizedValue(`{"key1":"remoteValue1","key2":"remoteValue2","key3":"remoteValue3"}`)
1518

@@ -30,6 +33,7 @@ func TestMergeSettings(t *testing.T) {
3033
})
3134

3235
t.Run("excludes config keys missing in remote", func(t *testing.T) {
36+
t.Parallel()
3337
configSettings := jsontypes.NewNormalizedValue(`{"key1":"configValue1","key2":"configValue2"}`)
3438
remoteSettings := jsontypes.NewNormalizedValue(`{"key1":"remoteValue1"}`)
3539

@@ -50,6 +54,7 @@ func TestMergeSettings(t *testing.T) {
5054
})
5155

5256
t.Run("ignores backend-only settings", func(t *testing.T) {
57+
t.Parallel()
5358
configSettings := jsontypes.NewNormalizedValue(`{"apiKey":"myKey"}`)
5459
remoteSettings := jsontypes.NewNormalizedValue(`{"apiKey":"myKey","autoGeneratedField":"autoValue","internalFlag":true}`)
5560

@@ -69,6 +74,7 @@ func TestMergeSettings(t *testing.T) {
6974
})
7075

7176
t.Run("detects drift in config-defined settings", func(t *testing.T) {
77+
t.Parallel()
7278
configSettings := jsontypes.NewNormalizedValue(`{"key1":"originalValue","key2":"originalValue2"}`)
7379
remoteSettings := jsontypes.NewNormalizedValue(`{"key1":"driftedValue","key2":"originalValue2"}`)
7480

@@ -86,6 +92,7 @@ func TestMergeSettings(t *testing.T) {
8692
})
8793

8894
t.Run("handles empty config settings", func(t *testing.T) {
95+
t.Parallel()
8996
configSettings := jsontypes.NewNormalizedValue(`{}`)
9097
remoteSettings := jsontypes.NewNormalizedValue(`{"key1":"remoteValue1"}`)
9198

@@ -102,6 +109,7 @@ func TestMergeSettings(t *testing.T) {
102109
})
103110

104111
t.Run("handles complex nested settings", func(t *testing.T) {
112+
t.Parallel()
105113
configSettings := jsontypes.NewNormalizedValue(`{"nested":{"key1":"value1"},"simple":"value"}`)
106114
remoteSettings := jsontypes.NewNormalizedValue(`{"nested":{"key1":"changedValue"},"simple":"value","extra":"ignored"}`)
107115

@@ -120,6 +128,7 @@ func TestMergeSettings(t *testing.T) {
120128
})
121129

122130
t.Run("returns error for invalid config JSON", func(t *testing.T) {
131+
t.Parallel()
123132
configSettings := jsontypes.NewNormalizedValue(`invalid json`)
124133
remoteSettings := jsontypes.NewNormalizedValue(`{"key":"value"}`)
125134

@@ -130,6 +139,7 @@ func TestMergeSettings(t *testing.T) {
130139
})
131140

132141
t.Run("returns error for invalid remote JSON", func(t *testing.T) {
142+
t.Parallel()
133143
configSettings := jsontypes.NewNormalizedValue(`{"key":"value"}`)
134144
remoteSettings := jsontypes.NewNormalizedValue(`invalid json`)
135145

@@ -140,6 +150,7 @@ func TestMergeSettings(t *testing.T) {
140150
})
141151

142152
t.Run("preserves config password when isWarehouse is true", func(t *testing.T) {
153+
t.Parallel()
143154
configSettings := jsontypes.NewNormalizedValue(`{"password":"secretPassword","username":"user123"}`)
144155
remoteSettings := jsontypes.NewNormalizedValue(`{"username":"user123"}`)
145156

@@ -157,6 +168,7 @@ func TestMergeSettings(t *testing.T) {
157168
})
158169

159170
t.Run("does not preserve password when isWarehouse is false", func(t *testing.T) {
171+
t.Parallel()
160172
configSettings := jsontypes.NewNormalizedValue(`{"password":"secretPassword","username":"user123"}`)
161173
remoteSettings := jsontypes.NewNormalizedValue(`{"username":"user123"}`)
162174

@@ -174,6 +186,7 @@ func TestMergeSettings(t *testing.T) {
174186
})
175187

176188
t.Run("preserves config value when remote secret is censored", func(t *testing.T) {
189+
t.Parallel()
177190
configSettings := jsontypes.NewNormalizedValue(`{"apiKey":"mySecretKey","publicKey":"publicValue"}`)
178191
remoteSettings := jsontypes.NewNormalizedValue(`{"apiKey":"••••••••","publicKey":"publicValue"}`)
179192

@@ -192,6 +205,7 @@ func TestMergeSettings(t *testing.T) {
192205
})
193206

194207
t.Run("handles multiple censored secrets", func(t *testing.T) {
208+
t.Parallel()
195209
configSettings := jsontypes.NewNormalizedValue(`{"secret1":"value1","secret2":"value2","normal":"normalValue"}`)
196210
remoteSettings := jsontypes.NewNormalizedValue(`{"secret1":"••••","secret2":"•••••••","normal":"normalValue"}`)
197211

@@ -211,6 +225,7 @@ func TestMergeSettings(t *testing.T) {
211225
})
212226

213227
t.Run("handles censored secrets in warehouse mode", func(t *testing.T) {
228+
t.Parallel()
214229
configSettings := jsontypes.NewNormalizedValue(`{"password":"dbPassword","apiKey":"myApiKey","username":"user"}`)
215230
remoteSettings := jsontypes.NewNormalizedValue(`{"apiKey":"••••••••","username":"user"}`)
216231

@@ -231,6 +246,7 @@ func TestMergeSettings(t *testing.T) {
231246
})
232247

233248
t.Run("only treats strings with bullet character as censored", func(t *testing.T) {
249+
t.Parallel()
234250
configSettings := jsontypes.NewNormalizedValue(`{"key1":"configValue","key2":"configValue2"}`)
235251
remoteSettings := jsontypes.NewNormalizedValue(`{"key1":"dotdotdot...","key2":"••••"}`)
236252

internal/provider/warehouse_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ func (r *warehouseResource) Read(ctx context.Context, req resource.ReadRequest,
324324
"Unable to merge Warehouse settings",
325325
err.Error(),
326326
)
327+
327328
return
328329
}
329330
state.Settings = mergedSettings

0 commit comments

Comments
 (0)