@@ -9,7 +9,10 @@ import (
9
9
)
10
10
11
11
func TestMergeSettings (t * testing.T ) {
12
+ t .Parallel ()
13
+
12
14
t .Run ("merges config-defined settings with remote values" , func (t * testing.T ) {
15
+ t .Parallel ()
13
16
configSettings := jsontypes .NewNormalizedValue (`{"key1":"configValue1","key2":"configValue2"}` )
14
17
remoteSettings := jsontypes .NewNormalizedValue (`{"key1":"remoteValue1","key2":"remoteValue2","key3":"remoteValue3"}` )
15
18
@@ -30,6 +33,7 @@ func TestMergeSettings(t *testing.T) {
30
33
})
31
34
32
35
t .Run ("excludes config keys missing in remote" , func (t * testing.T ) {
36
+ t .Parallel ()
33
37
configSettings := jsontypes .NewNormalizedValue (`{"key1":"configValue1","key2":"configValue2"}` )
34
38
remoteSettings := jsontypes .NewNormalizedValue (`{"key1":"remoteValue1"}` )
35
39
@@ -50,6 +54,7 @@ func TestMergeSettings(t *testing.T) {
50
54
})
51
55
52
56
t .Run ("ignores backend-only settings" , func (t * testing.T ) {
57
+ t .Parallel ()
53
58
configSettings := jsontypes .NewNormalizedValue (`{"apiKey":"myKey"}` )
54
59
remoteSettings := jsontypes .NewNormalizedValue (`{"apiKey":"myKey","autoGeneratedField":"autoValue","internalFlag":true}` )
55
60
@@ -69,6 +74,7 @@ func TestMergeSettings(t *testing.T) {
69
74
})
70
75
71
76
t .Run ("detects drift in config-defined settings" , func (t * testing.T ) {
77
+ t .Parallel ()
72
78
configSettings := jsontypes .NewNormalizedValue (`{"key1":"originalValue","key2":"originalValue2"}` )
73
79
remoteSettings := jsontypes .NewNormalizedValue (`{"key1":"driftedValue","key2":"originalValue2"}` )
74
80
@@ -86,6 +92,7 @@ func TestMergeSettings(t *testing.T) {
86
92
})
87
93
88
94
t .Run ("handles empty config settings" , func (t * testing.T ) {
95
+ t .Parallel ()
89
96
configSettings := jsontypes .NewNormalizedValue (`{}` )
90
97
remoteSettings := jsontypes .NewNormalizedValue (`{"key1":"remoteValue1"}` )
91
98
@@ -102,6 +109,7 @@ func TestMergeSettings(t *testing.T) {
102
109
})
103
110
104
111
t .Run ("handles complex nested settings" , func (t * testing.T ) {
112
+ t .Parallel ()
105
113
configSettings := jsontypes .NewNormalizedValue (`{"nested":{"key1":"value1"},"simple":"value"}` )
106
114
remoteSettings := jsontypes .NewNormalizedValue (`{"nested":{"key1":"changedValue"},"simple":"value","extra":"ignored"}` )
107
115
@@ -120,6 +128,7 @@ func TestMergeSettings(t *testing.T) {
120
128
})
121
129
122
130
t .Run ("returns error for invalid config JSON" , func (t * testing.T ) {
131
+ t .Parallel ()
123
132
configSettings := jsontypes .NewNormalizedValue (`invalid json` )
124
133
remoteSettings := jsontypes .NewNormalizedValue (`{"key":"value"}` )
125
134
@@ -130,6 +139,7 @@ func TestMergeSettings(t *testing.T) {
130
139
})
131
140
132
141
t .Run ("returns error for invalid remote JSON" , func (t * testing.T ) {
142
+ t .Parallel ()
133
143
configSettings := jsontypes .NewNormalizedValue (`{"key":"value"}` )
134
144
remoteSettings := jsontypes .NewNormalizedValue (`invalid json` )
135
145
@@ -140,6 +150,7 @@ func TestMergeSettings(t *testing.T) {
140
150
})
141
151
142
152
t .Run ("preserves config password when isWarehouse is true" , func (t * testing.T ) {
153
+ t .Parallel ()
143
154
configSettings := jsontypes .NewNormalizedValue (`{"password":"secretPassword","username":"user123"}` )
144
155
remoteSettings := jsontypes .NewNormalizedValue (`{"username":"user123"}` )
145
156
@@ -157,6 +168,7 @@ func TestMergeSettings(t *testing.T) {
157
168
})
158
169
159
170
t .Run ("does not preserve password when isWarehouse is false" , func (t * testing.T ) {
171
+ t .Parallel ()
160
172
configSettings := jsontypes .NewNormalizedValue (`{"password":"secretPassword","username":"user123"}` )
161
173
remoteSettings := jsontypes .NewNormalizedValue (`{"username":"user123"}` )
162
174
@@ -174,6 +186,7 @@ func TestMergeSettings(t *testing.T) {
174
186
})
175
187
176
188
t .Run ("preserves config value when remote secret is censored" , func (t * testing.T ) {
189
+ t .Parallel ()
177
190
configSettings := jsontypes .NewNormalizedValue (`{"apiKey":"mySecretKey","publicKey":"publicValue"}` )
178
191
remoteSettings := jsontypes .NewNormalizedValue (`{"apiKey":"••••••••","publicKey":"publicValue"}` )
179
192
@@ -192,6 +205,7 @@ func TestMergeSettings(t *testing.T) {
192
205
})
193
206
194
207
t .Run ("handles multiple censored secrets" , func (t * testing.T ) {
208
+ t .Parallel ()
195
209
configSettings := jsontypes .NewNormalizedValue (`{"secret1":"value1","secret2":"value2","normal":"normalValue"}` )
196
210
remoteSettings := jsontypes .NewNormalizedValue (`{"secret1":"••••","secret2":"•••••••","normal":"normalValue"}` )
197
211
@@ -211,6 +225,7 @@ func TestMergeSettings(t *testing.T) {
211
225
})
212
226
213
227
t .Run ("handles censored secrets in warehouse mode" , func (t * testing.T ) {
228
+ t .Parallel ()
214
229
configSettings := jsontypes .NewNormalizedValue (`{"password":"dbPassword","apiKey":"myApiKey","username":"user"}` )
215
230
remoteSettings := jsontypes .NewNormalizedValue (`{"apiKey":"••••••••","username":"user"}` )
216
231
@@ -231,6 +246,7 @@ func TestMergeSettings(t *testing.T) {
231
246
})
232
247
233
248
t .Run ("only treats strings with bullet character as censored" , func (t * testing.T ) {
249
+ t .Parallel ()
234
250
configSettings := jsontypes .NewNormalizedValue (`{"key1":"configValue","key2":"configValue2"}` )
235
251
remoteSettings := jsontypes .NewNormalizedValue (`{"key1":"dotdotdot...","key2":"••••"}` )
236
252
0 commit comments