Skip to content

Commit f84d4f9

Browse files
committed
Improve test
1 parent e40bfc1 commit f84d4f9

File tree

1 file changed

+8
-6
lines changed
  • kernel/src/table_changes/log_replay

1 file changed

+8
-6
lines changed

kernel/src/table_changes/log_replay/tests.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ async fn column_mapping_should_fail() {
185185
// Note: This should be removed once type widening support is added for CDF
186186
#[tokio::test]
187187
async fn incompatible_schemas_fail() {
188+
const PASSES: bool = true;
189+
const FAILS: bool = false;
188190
async fn assert_schema_check(commit_schema: StructType, cdf_schema: StructType, passes: bool) {
189191
let engine = Arc::new(SyncEngine::new());
190192
let mut mock_table = LocalMockTable::new();
@@ -229,7 +231,7 @@ async fn incompatible_schemas_fail() {
229231
StructField::nullable("value", DataType::STRING),
230232
StructField::nullable("year", DataType::INTEGER),
231233
]);
232-
assert_schema_check(schema, get_schema(), false).await;
234+
assert_schema_check(schema, get_schema(), FAILS).await;
233235

234236
// Commit schema's `id` column has wider type than in the read schema.
235237
//
@@ -239,7 +241,7 @@ async fn incompatible_schemas_fail() {
239241
StructField::nullable("id", DataType::LONG),
240242
StructField::nullable("value", DataType::STRING),
241243
]);
242-
assert_schema_check(schema, get_schema(), false).await;
244+
assert_schema_check(schema, get_schema(), FAILS).await;
243245

244246
// Commit schema's `id` column is narrower than in the read schema.
245247
// NOTE: Once type widening is supported, this should not return an error.
@@ -254,7 +256,7 @@ async fn incompatible_schemas_fail() {
254256
StructField::nullable("id", DataType::INTEGER),
255257
StructField::nullable("value", DataType::STRING),
256258
]);
257-
assert_schema_check(commit_schema, cdf_schema, false).await;
259+
assert_schema_check(commit_schema, cdf_schema, FAILS).await;
258260

259261
// Commit schema's `id` column has an incompatible type with the read schema's.
260262
//
@@ -264,7 +266,7 @@ async fn incompatible_schemas_fail() {
264266
StructField::nullable("id", DataType::STRING),
265267
StructField::nullable("value", DataType::STRING),
266268
]);
267-
assert_schema_check(schema, get_schema(), false).await;
269+
assert_schema_check(schema, get_schema(), FAILS).await;
268270

269271
// Commit schema's `id` column is non-nullable, but is nullable in the read schema.
270272
//
@@ -274,14 +276,14 @@ async fn incompatible_schemas_fail() {
274276
StructField::new("id", DataType::INTEGER, false),
275277
StructField::new("value", DataType::STRING, true),
276278
]);
277-
assert_schema_check(schema, get_schema(), true).await;
279+
assert_schema_check(schema, get_schema(), PASSES).await;
278280

279281
// Commit schema is missing a nullable `value` column that's found in the read schema.
280282
//
281283
// The CDF schema has fields: `id` (nullable) and `value` (nullable).
282284
// This commit has schema with fields: `id` (nullable).
283285
let schema = get_schema().project_as_struct(&["id"]).unwrap();
284-
assert_schema_check(schema, get_schema(), true).await;
286+
assert_schema_check(schema, get_schema(), PASSES).await;
285287
}
286288

287289
#[tokio::test]

0 commit comments

Comments
 (0)