@@ -38,16 +38,16 @@ func TestUpstreamSchemaWithoutColumns(t *testing.T) {
38
38
schema_1response .newTable ("table_1" , false , nil )
39
39
// as table_2 stays enabled on switch to BLOCK_ALL - column settings are fetched from source and saved in config
40
40
schema_1response .newTable ("table_2" , true , nil ).
41
- newColumn ("column_1" , true , boolPtr (false )).
42
- newColumn ("column_2" , true , boolPtr (false ))
41
+ newColumn ("column_1" , true , boolPtr (false ), true ).
42
+ newColumn ("column_2" , true , boolPtr (false ), false )
43
43
schema_1response .newTable ("table_3" , false , nil )
44
44
45
45
schema_2response := responseConfig .newSchema ("schema_2" , true )
46
46
schema_2response .newTable ("table_1" , false , nil )
47
47
// as table_2 stays enabled on switch to BLOCK_ALL - column settings are fetched from source and saved in config
48
48
schema_2response .newTable ("table_2" , true , nil ).
49
- newColumn ("column_1" , true , boolPtr (false )).
50
- newColumn ("column_2" , true , boolPtr (false ))
49
+ newColumn ("column_1" , true , boolPtr (false ), true ).
50
+ newColumn ("column_2" , true , boolPtr (false ), false )
51
51
schema_2response .newTable ("table_3" , false , nil )
52
52
53
53
body := setupOneStepTest (t , upstreamConfig , tfConfig , responseConfig )
@@ -92,25 +92,25 @@ func TestUpstreamSchemaWithoutColumnsColumnConfigured(t *testing.T) {
92
92
// Enable only two tables
93
93
tfConfig .newSchema ("schema_1" , true ).
94
94
newTable ("table_1" , true , nil ).
95
- newColumn ("column_1" , true , nil )
95
+ newColumn ("column_1" , true , nil , true )
96
96
97
97
responseConfig := schemaConfigTestData {
98
98
schemaChangeHandling : "BLOCK_ALL" ,
99
99
}
100
100
101
101
responseConfig .newSchema ("schema_1" , true ).
102
102
newTable ("table_1" , true , nil ).
103
- newColumn ("column_1" , true , boolPtr (false )). // column user configured in tf
104
- newColumn ("column_2" , true , boolPtr (false )) // column present in source, but not saved to standard config before switch to BA mode
103
+ newColumn ("column_1" , true , boolPtr (false ), false ). // column user configured in tf
104
+ newColumn ("column_2" , true , boolPtr (false ), false ) // column present in source, but not saved to standard config before switch to BA mode
105
105
106
106
response2Config := schemaConfigTestData {
107
107
schemaChangeHandling : "BLOCK_ALL" ,
108
108
}
109
109
110
110
response2Config .newSchema ("schema_1" , true ).
111
111
newTable ("table_1" , true , nil ).
112
- newColumn ("column_1" , true , boolPtr (false )). // column user configured in tf
113
- newColumn ("column_2" , false , boolPtr (false )) // column set disbled after second patch
112
+ newColumn ("column_1" , true , boolPtr (false ), false ). // column user configured in tf
113
+ newColumn ("column_2" , false , boolPtr (false ), false ) // column set disbled after second patch
114
114
115
115
bodies := setupComplexTestWithColumnsReload (
116
116
t , upstreamConfig ,
@@ -119,7 +119,7 @@ func TestUpstreamSchemaWithoutColumnsColumnConfigured(t *testing.T) {
119
119
map [string ]map [string ][]columnsConfigTestData {
120
120
"schema_1" : map [string ][]columnsConfigTestData {
121
121
"table_1" : []columnsConfigTestData {
122
- newColumnConfigTestData ().newColumn ("column_1" , false , boolPtr (false )).newColumn ("column_2" , false , boolPtr (false )),
122
+ newColumnConfigTestData ().newColumn ("column_1" , false , boolPtr (false ), true ).newColumn ("column_2" , false , boolPtr (false ), false ),
123
123
},
124
124
},
125
125
})
@@ -142,7 +142,7 @@ func TestUpstreamSchemaWithoutColumnsColumnConfigured(t *testing.T) {
142
142
143
143
assertEqual (t , len (columns ), 1 )
144
144
column11 := AssertKeyExists (t , columns , "column_1" ).(map [string ]interface {})
145
- assertEqual (t , len (column11 ), 1 )
145
+ assertEqual (t , len (column11 ), 2 )
146
146
assertKeyExistsAndHasValue (t , column11 , "enabled" , true )
147
147
148
148
body2 := bodies [1 ]
@@ -160,7 +160,7 @@ func TestUpstreamSchemaWithoutColumnsColumnConfigured(t *testing.T) {
160
160
columns = AssertKeyExists (t , table11 , "columns" ).(map [string ]interface {})
161
161
assertEqual (t , len (columns ), 1 )
162
162
column12 := AssertKeyExists (t , columns , "column_2" ).(map [string ]interface {})
163
- assertEqual (t , len (column12 ), 1 )
163
+ assertEqual (t , len (column12 ), 2 )
164
164
assertKeyExistsAndHasValue (t , column12 , "enabled" , false )
165
165
}
166
166
@@ -173,14 +173,14 @@ func TestSchemaDoesntTouchColumnsInBlockAllIfNoColumnSettingsMock(t *testing.T)
173
173
schema_1 := upstreamConfig .newSchema ("schema_1" , true )
174
174
175
175
schema_1 .newTable ("table_1" , true , nil ).
176
- newColumnLocked ("column_1" , true , boolPtr (false )).
177
- newColumn ("column_2" , true , boolPtr (false )).
178
- newColumn ("column_3" , true , boolPtr (true ))
176
+ newColumnLocked ("column_1" , true , boolPtr (false ), true ).
177
+ newColumn ("column_2" , true , boolPtr (false ), false ).
178
+ newColumn ("column_3" , true , boolPtr (true ), false )
179
179
180
180
schema_1 .newTable ("table_2" , true , nil ).
181
- newColumnLocked ("column_1" , true , boolPtr (false )).
182
- newColumn ("column_2" , true , boolPtr (false )).
183
- newColumn ("column_3" , true , boolPtr (true ))
181
+ newColumnLocked ("column_1" , true , boolPtr (false ), true ).
182
+ newColumn ("column_2" , true , boolPtr (false ), false ).
183
+ newColumn ("column_3" , true , boolPtr (true ), false )
184
184
185
185
// only schema_1.table_1 will stay enabled
186
186
// table_2 will be disabled
@@ -199,15 +199,15 @@ func TestSchemaDoesntTouchColumnsInBlockAllIfNoColumnSettingsMock(t *testing.T)
199
199
schema_1response := responseConfig .newSchema ("schema_1" , true )
200
200
// table_1 enabled, existing columns saved settings
201
201
schema_1response .newTable ("table_1" , true , nil ).
202
- newColumnLocked ("column_1" , true , boolPtr (false )).
203
- newColumn ("column_2" , true , boolPtr (false )).
204
- newColumn ("column_3" , true , boolPtr (true ))
202
+ newColumnLocked ("column_1" , true , boolPtr (false ), true ).
203
+ newColumn ("column_2" , true , boolPtr (false ), false ).
204
+ newColumn ("column_3" , true , boolPtr (true ), false )
205
205
206
206
// table_2 enabled, existing columns saved settings
207
207
schema_1response .newTable ("table_2" , false , nil ).
208
- newColumnLocked ("column_1" , true , boolPtr (false )).
209
- newColumn ("column_2" , true , boolPtr (false )).
210
- newColumn ("column_3" , true , boolPtr (true ))
208
+ newColumnLocked ("column_1" , true , boolPtr (false ), true ).
209
+ newColumn ("column_2" , true , boolPtr (false ), false ).
210
+ newColumn ("column_3" , true , boolPtr (true ), false )
211
211
212
212
// act
213
213
body := setupOneStepTest (t , upstreamConfig , tfConfig , responseConfig )
@@ -231,9 +231,9 @@ func TestSetupSchemaBlockAllMock(t *testing.T) {
231
231
schema_1 := upstreamConfig .newSchema ("schema_1" , true )
232
232
233
233
schema_1 .newTable ("table_1" , true , nil ).
234
- newColumnLocked ("column_1" , true , boolPtr (false )).
235
- newColumn ("column_2" , true , boolPtr (false )).
236
- newColumn ("column_3" , true , boolPtr (true ))
234
+ newColumnLocked ("column_1" , true , boolPtr (false ), true ).
235
+ newColumn ("column_2" , true , boolPtr (false ), false ).
236
+ newColumn ("column_3" , true , boolPtr (true ), false )
237
237
238
238
schema_1 .newTableLocked ("table_locked" , true , nil )
239
239
@@ -243,17 +243,17 @@ func TestSetupSchemaBlockAllMock(t *testing.T) {
243
243
244
244
tfConfig .newSchema ("schema_1" , true ).
245
245
newTable ("table_1" , true , nil ).
246
- newColumn ("column_2" , true , nil )
246
+ newColumn ("column_2" , true , nil , true )
247
247
248
248
responseConfig := schemaConfigTestData {
249
249
schemaChangeHandling : "BLOCK_ALL" ,
250
250
}
251
251
252
252
schema_1response := responseConfig .newSchema ("schema_1" , true )
253
253
schema_1response .newTable ("table_1" , true , nil ).
254
- newColumnLocked ("column_1" , true , boolPtr (false )).
255
- newColumn ("column_2" , true , boolPtr (false )).
256
- newColumn ("column_3" , false , boolPtr (true ))
254
+ newColumnLocked ("column_1" , true , boolPtr (false ), true ).
255
+ newColumn ("column_2" , true , boolPtr (false ), false ).
256
+ newColumn ("column_3" , false , boolPtr (true ), false )
257
257
schema_1response .newTableLocked ("table_locked" , true , nil )
258
258
259
259
// act
@@ -272,7 +272,7 @@ func TestSetupSchemaBlockAllMock(t *testing.T) {
272
272
273
273
assertEqual (t , len (columns ), 1 )
274
274
column3 := assertKeyExists (t , columns , "column_3" ).(map [string ]interface {})
275
- assertEqual (t , len (column3 ), 1 )
275
+ assertEqual (t , len (column3 ), 2 )
276
276
assertKeyExistsAndHasValue (t , column3 , "enabled" , false )
277
277
}
278
278
@@ -282,26 +282,26 @@ func TestIgnoreNoPatchAllowedColumnsMock(t *testing.T) {
282
282
}
283
283
upstreamConfig .newSchema ("schema_1" , true ).
284
284
newTable ("table_1" , true , nil ).
285
- newColumn ("column_1" , true , boolPtr (false )).
286
- newColumn ("column_2" , true , boolPtr (false )).
287
- newColumn ("column_3" , true , boolPtr (true ))
285
+ newColumn ("column_1" , true , boolPtr (false ), true ).
286
+ newColumn ("column_2" , true , boolPtr (false ), false ).
287
+ newColumn ("column_3" , true , boolPtr (true ), false )
288
288
289
289
tfConfig := schemaConfigTestData {
290
290
schemaChangeHandling : "BLOCK_ALL" ,
291
291
}
292
292
293
293
tfConfig .newSchema ("schema_1" , true ).
294
294
newTable ("table_1" , true , nil ).
295
- newColumn ("column_2" , true , nil )
295
+ newColumn ("column_2" , true , nil , true )
296
296
297
297
responseConfig := schemaConfigTestData {
298
298
schemaChangeHandling : "BLOCK_ALL" ,
299
299
}
300
300
responseConfig .newSchema ("schema_1" , true ).
301
301
newTable ("table_1" , true , nil ).
302
- newColumn ("column_1" , false , boolPtr (false )).
303
- newColumn ("column_2" , true , boolPtr (false )).
304
- newColumn ("column_3" , false , boolPtr (true ))
302
+ newColumn ("column_1" , false , boolPtr (false ), true ).
303
+ newColumn ("column_2" , true , boolPtr (false ), false ).
304
+ newColumn ("column_3" , false , boolPtr (true ), false )
305
305
306
306
// act
307
307
body := setupOneStepTest (t , upstreamConfig , tfConfig , responseConfig )
@@ -317,10 +317,10 @@ func TestIgnoreNoPatchAllowedColumnsMock(t *testing.T) {
317
317
columns := assertKeyExists (t , table_1 , "columns" ).(map [string ]interface {})
318
318
assertEqual (t , len (columns ), 2 )
319
319
column_1 := assertKeyExists (t , columns , "column_1" ).(map [string ]interface {})
320
- assertEqual (t , len (column_1 ), 1 )
320
+ assertEqual (t , len (column_1 ), 2 )
321
321
assertKeyExistsAndHasValue (t , column_1 , "enabled" , false )
322
322
column_3 := assertKeyExists (t , columns , "column_3" ).(map [string ]interface {})
323
- assertEqual (t , len (column_3 ), 1 )
323
+ assertEqual (t , len (column_3 ), 2 )
324
324
assertKeyExistsAndHasValue (t , column_3 , "enabled" , false )
325
325
}
326
326
0 commit comments