@@ -2084,7 +2084,7 @@ class MetacatSmokeSpec extends Specification {
2084
2084
/*
2085
2085
Step 4: create another table with the same name different uuid without specifying the parent child relation
2086
2086
but should fail because the table already exists
2087
- This test the revert should not impact the previous record
2087
+ This test the revert during creation should not impact the previous record
2088
2088
*/
2089
2089
when:
2090
2090
child11TableDto = PigDataDtoProvider.getTable(catalogName, databaseName, child11, 'amajumdar', child11Uri)
@@ -2151,36 +2151,7 @@ class MetacatSmokeSpec extends Specification {
2151
2151
assert e.message.contains(" Cannot create a parent table on top of another parent" )
2152
2152
2153
2153
/*
2154
- Step 7: create another table with the same parent1 name but should fail because the table already exists
2155
- Test the revert should not impact the previous record
2156
- */
2157
- when:
2158
- api.createTable(catalogName, databaseName, parent1, parent1TableDto)
2159
- then:
2160
- e = thrown(Exception)
2161
- assert e.message.contains(" already exists" )
2162
-
2163
- when:
2164
- parent1Table = api.getTable(catalogName, databaseName, parent1, true, true, false)
2165
- child11Table = api.getTable(catalogName, databaseName, child11, true, true, false)
2166
- then:
2167
- // Test Parent 1 parentChildInfo
2168
- assert parent1Table.definitionMetadata.get(" parentChildRelationInfo" ).get(" isParent" ).booleanValue()
2169
- assert parentChildRelV1.getChildren(catalogName, databaseName, parent1) == [
2170
- new ChildInfoDto(" embedded- fast- hive- metastore/ iceberg_db/ child11" , " CLONE " , " c11_uuid" ),
2171
- new ChildInfoDto(" embedded- fast- hive- metastore/ iceberg_db/ child12" , " CLONE " , " c12_uuid" )
2172
- ] as Set
2173
-
2174
- // Test Child11 parentChildInfo
2175
- assert !child11Table.definitionMetadata.get(" parentChildRelationInfo" ).has(" isParent" )
2176
- assert child11Table.definitionMetadata.get(" random_key" ).asText() == " random_value"
2177
- JSONAssert.assertEquals(child11Table.definitionMetadata.get(" parentChildRelationInfo" ).toString(),
2178
- '{" parentInfos" :[{" name" :" embedded- fast- hive- metastore/ iceberg_db/ parent1" ," relationType" :" CLONE " , " uuid" :" p1_uuid" }]}',
2179
- false)
2180
- assert parentChildRelV1.getChildren(catalogName, databaseName, child11).isEmpty()
2181
-
2182
- /*
2183
- Step 8: Create one grandChild As a Parent of A child table should fail
2154
+ Step 7: Create one grandChild As a Parent of A child table should fail
2184
2155
*/
2185
2156
when:
2186
2157
def grandchild121TableDto = PigDataDtoProvider.getTable(catalogName, databaseName, grandChild121, 'amajumdar', null)
@@ -2192,7 +2163,7 @@ class MetacatSmokeSpec extends Specification {
2192
2163
assert e.message.contains(" Cannot create a child table as parent" )
2193
2164
2194
2165
/*
2195
- Step 9 : Create another parent child that is disconnected with the above
2166
+ Step 8 : Create another parent child that is disconnected with the above
2196
2167
*/
2197
2168
when:
2198
2169
// Create Parent2
@@ -2220,7 +2191,8 @@ class MetacatSmokeSpec extends Specification {
2220
2191
assert parentChildRelV1.getChildren(catalogName, databaseName, child21).isEmpty()
2221
2192
2222
2193
/*
2223
- Step 10: Create a table newParent1 and attempt to rename parent1 to newParent1 should fail
2194
+ Step 9: Create a table newParent1 without any parent child rel info
2195
+ and attempt to rename parent1 to newParent1 should fail
2224
2196
Test the parentChildRelationship record remain the same after the revert
2225
2197
*/
2226
2198
when:
@@ -2257,6 +2229,53 @@ class MetacatSmokeSpec extends Specification {
2257
2229
false)
2258
2230
assert parentChildRelV1.getChildren(catalogName, databaseName, child12).isEmpty()
2259
2231
2232
+ /*
2233
+ Step 10: Attempt to rename parent1 to parent2 should fail
2234
+ Test the parentChildRelationship record remain the same after the revert
2235
+ */
2236
+ when:
2237
+ api.renameTable(catalogName, databaseName, parent1, parent2)
2238
+ then:
2239
+ e = thrown(Exception)
2240
+ assert e.message.contains(" already exists in parent child relationship service" )
2241
+
2242
+ when:
2243
+ parent1Table = api.getTable(catalogName, databaseName, parent1, true, true, false)
2244
+ child11Table = api.getTable(catalogName, databaseName, child11, true, true, false)
2245
+ child12Table = api.getTable(catalogName, databaseName, child12, true, true, false)
2246
+ parent2Table = api.getTable(catalogName, databaseName, parent2, true, true, false)
2247
+ child21Table = api.getTable(catalogName, databaseName, child21, true, true, false)
2248
+ then:
2249
+ // Test Parent 1 parentChildInfo
2250
+ assert parent1Table.definitionMetadata.get(" parentChildRelationInfo" ).get(" isParent" ).booleanValue()
2251
+ assert parentChildRelV1.getChildren(catalogName, databaseName, parent1) == [
2252
+ new ChildInfoDto(" embedded- fast- hive- metastore/ iceberg_db/ child11" , " CLONE " , " c11_uuid" ),
2253
+ new ChildInfoDto(" embedded- fast- hive- metastore/ iceberg_db/ child12" , " CLONE " , " c12_uuid" )
2254
+ ] as Set
2255
+ // Test Child11 parentChildInfo
2256
+ assert !child11Table.definitionMetadata.get(" parentChildRelationInfo" ).has(" isParent" )
2257
+ assert child11Table.definitionMetadata.get(" random_key" ).asText() == " random_value"
2258
+ JSONAssert.assertEquals(child11Table.definitionMetadata.get(" parentChildRelationInfo" ).toString(),
2259
+ '{" parentInfos" :[{" name" :" embedded- fast- hive- metastore/ iceberg_db/ parent1" ," relationType" :" CLONE " , " uuid" :" p1_uuid" }]}',
2260
+ false)
2261
+ assert parentChildRelV1.getChildren(catalogName, databaseName, child11).isEmpty()
2262
+ // Test Child12 parentChildInfo
2263
+ assert !child12Table.definitionMetadata.get(" parentChildRelationInfo" ).has(" isParent" )
2264
+ JSONAssert.assertEquals(child12Table.definitionMetadata.get(" parentChildRelationInfo" ).toString(),
2265
+ '{" parentInfos" :[{" name" :" embedded- fast- hive- metastore/ iceberg_db/ parent1" ," relationType" :" CLONE " ," uuid" :" p1_uuid" }]}',
2266
+ false)
2267
+ assert parentChildRelV1.getChildren(catalogName, databaseName, child12).isEmpty()
2268
+ // Test Parent 2 parentChildInfo
2269
+ assert parent2Table.definitionMetadata.get(" parentChildRelationInfo" ).get(" isParent" ).booleanValue()
2270
+ assert parentChildRelV1.getChildren(catalogName, databaseName, parent2) == [
2271
+ new ChildInfoDto(" embedded- fast- hive- metastore/ iceberg_db/ child21" , " CLONE " , " c21_uuid" )
2272
+ ] as Set
2273
+ // Test Child21 parentChildInfo
2274
+ JSONAssert.assertEquals(child21Table.definitionMetadata.get(" parentChildRelationInfo" ).toString(),
2275
+ '{" parentInfos" :[{" name" :" embedded- fast- hive- metastore/ iceberg_db/ parent2" ," relationType" :" CLONE " ," uuid" :" p2_uuid" }]}',
2276
+ false)
2277
+ assert parentChildRelV1.getChildren(catalogName, databaseName, child21).isEmpty()
2278
+
2260
2279
2261
2280
/*
2262
2281
Step 11: First drop the newParent1 and then Rename parent1 to newParent1 should now succeed
@@ -2386,7 +2405,7 @@ class MetacatSmokeSpec extends Specification {
2386
2405
2387
2406
2388
2407
/*
2389
- Step 13 : Drop previous renameChild11 and Rename child11 to renameChild11
2408
+ Step 14 : Drop previous renameChild11 and Rename child11 to renameChild11
2390
2409
*/
2391
2410
when:
2392
2411
api.deleteTable(catalogName, databaseName, renameChild11)
@@ -2417,7 +2436,7 @@ class MetacatSmokeSpec extends Specification {
2417
2436
assert e.message.contains(" Unable to locate for " )
2418
2437
2419
2438
/*
2420
- Step 14: Drop parent renameParent1
2439
+ Step 15 Drop parent renameParent1
2421
2440
*/
2422
2441
when:
2423
2442
api.deleteTable(catalogName, databaseName, renameParent1)
@@ -2427,7 +2446,7 @@ class MetacatSmokeSpec extends Specification {
2427
2446
assert e.message.contains(" because it still has" )
2428
2447
2429
2448
/*
2430
- Step 15 : Drop renameChild11 should succeed
2449
+ Step 16 : Drop renameChild11 should succeed
2431
2450
*/
2432
2451
when:
2433
2452
api.deleteTable(catalogName, databaseName, renameChild11)
@@ -2441,7 +2460,7 @@ class MetacatSmokeSpec extends Specification {
2441
2460
] as Set
2442
2461
2443
2462
/*
2444
- Step 16 : Create renameChild11 and should expect random_key should appear at it is reattached
2463
+ Step 17 : Create renameChild11 and should expect random_key should appear at it is reattached
2445
2464
but parent childInfo should not as it is always coming from the parent child relationship service
2446
2465
which currently does not have any record
2447
2466
*/
@@ -2462,7 +2481,7 @@ class MetacatSmokeSpec extends Specification {
2462
2481
] as Set
2463
2482
2464
2483
/*
2465
- Step 17 : Drop child12 should succeed
2484
+ Step 18 : Drop child12 should succeed
2466
2485
*/
2467
2486
when:
2468
2487
api.deleteTable(catalogName, databaseName, child12)
@@ -2472,7 +2491,7 @@ class MetacatSmokeSpec extends Specification {
2472
2491
assert parentChildRelV1.getChildren(catalogName, databaseName, renameParent1).isEmpty()
2473
2492
2474
2493
/*
2475
- Step 18 : Drop renameParent1 should succeed as there is no more child under it
2494
+ Step 19 : Drop renameParent1 should succeed as there is no more child under it
2476
2495
*/
2477
2496
when:
2478
2497
api.deleteTable(catalogName, databaseName, renameParent1)
@@ -2496,7 +2515,7 @@ class MetacatSmokeSpec extends Specification {
2496
2515
assert parentChildRelV1.getChildren(catalogName, databaseName, child21).isEmpty()
2497
2516
2498
2517
/*
2499
- Step 19 : update parent2 with random parentChildRelationInfo to test immutability
2518
+ Step 20 : update parent2 with random parentChildRelationInfo to test immutability
2500
2519
*/
2501
2520
when:
2502
2521
def updateParent2Dto = parent2Table
@@ -2519,7 +2538,7 @@ class MetacatSmokeSpec extends Specification {
2519
2538
assert parentChildRelV1.getChildren(catalogName, databaseName, child21).isEmpty()
2520
2539
2521
2540
/*
2522
- Step 20 : update child21 with random parentChildRelationInfo to test immutability
2541
+ Step 21 : update child21 with random parentChildRelationInfo to test immutability
2523
2542
*/
2524
2543
when:
2525
2544
def updateChild21Dto = child21Table
0 commit comments