@@ -2407,32 +2407,44 @@ def test_earliest_start_date(sushi_context: Context):
24072407
24082408
24092409def test_deployability_index (make_snapshot ):
2410+ # Breaking change - should be both representantive / deployable
24102411 snapshot_a = make_snapshot (SqlModel (name = "a" , query = parse_one ("SELECT 1" )))
24112412 snapshot_a .categorize_as (SnapshotChangeCategory .BREAKING )
24122413
2414+ # Forward only breaking change - cannot be representative / deployable due to forward only
24132415 snapshot_b = make_snapshot (SqlModel (name = "b" , query = parse_one ("SELECT 1" )))
24142416 snapshot_b .categorize_as (SnapshotChangeCategory .BREAKING , forward_only = True )
24152417 snapshot_b .parents = (snapshot_a .snapshot_id ,)
24162418
2419+ # Indirect breaking - cannot be representative / deployable due to forward only non-deployable parent
24172420 snapshot_c = make_snapshot (SqlModel (name = "c" , query = parse_one ("SELECT 1" )))
24182421 snapshot_c .categorize_as (SnapshotChangeCategory .INDIRECT_BREAKING )
24192422 snapshot_c .parents = (snapshot_b .snapshot_id ,)
24202423
2424+ # Indirect breaking - cannot be representative / deployable due to forward only non-deployable parent
24212425 snapshot_d = make_snapshot (SqlModel (name = "d" , query = parse_one ("SELECT 1" )))
24222426 snapshot_d .categorize_as (SnapshotChangeCategory .INDIRECT_BREAKING )
24232427 snapshot_d .parents = (snapshot_b .snapshot_id , snapshot_a .snapshot_id )
24242428
2429+ # Non breaking - representative / deployable due to no breaking changes
24252430 snapshot_e = make_snapshot (SqlModel (name = "e" , query = parse_one ("SELECT 1" )))
24262431 snapshot_e .categorize_as (SnapshotChangeCategory .NON_BREAKING )
24272432
2433+ # Indirect breaking - can be representative / deployable due to deployable parents
24282434 snapshot_f = make_snapshot (SqlModel (name = "f" , query = parse_one ("SELECT 1" )))
24292435 snapshot_f .categorize_as (SnapshotChangeCategory .INDIRECT_BREAKING )
24302436 snapshot_f .parents = (snapshot_e .snapshot_id , snapshot_a .snapshot_id )
24312437
2438+ # Indirect non breaking - cannot be representative / deployable due to possible data drift from prod
24322439 snapshot_g = make_snapshot (SqlModel (name = "g" , query = parse_one ("SELECT 1" )))
24332440 snapshot_g .intervals = [(to_timestamp ("2023-01-01" ), to_timestamp ("2023-01-02" ))]
24342441 snapshot_g .categorize_as (SnapshotChangeCategory .INDIRECT_NON_BREAKING )
24352442 snapshot_g .parents = (snapshot_e .snapshot_id ,)
2443+
2444+ # Indirect breaking - cannot be representative / deployable due to indirect non breaking non-deployable parent
2445+ snapshot_h = make_snapshot (SqlModel (name = "h" , query = parse_one ("SELECT 1" )))
2446+ snapshot_h .categorize_as (SnapshotChangeCategory .INDIRECT_BREAKING )
2447+ snapshot_h .parents = (snapshot_g .snapshot_id ,)
24362448
24372449 snapshots = {
24382450 s .snapshot_id : s
@@ -2444,6 +2456,7 @@ def test_deployability_index(make_snapshot):
24442456 snapshot_e ,
24452457 snapshot_f ,
24462458 snapshot_g ,
2459+ snapshot_h ,
24472460 ]
24482461 }
24492462
@@ -2452,18 +2465,20 @@ def test_deployability_index(make_snapshot):
24522465 assert deployability_index .is_deployable (snapshot_a )
24532466 assert deployability_index .is_deployable (snapshot_e )
24542467 assert deployability_index .is_deployable (snapshot_f )
2455- assert not deployability_index .is_deployable (snapshot_g )
24562468 assert not deployability_index .is_deployable (snapshot_b )
24572469 assert not deployability_index .is_deployable (snapshot_c )
24582470 assert not deployability_index .is_deployable (snapshot_d )
2471+ assert not deployability_index .is_deployable (snapshot_g )
2472+ assert not deployability_index .is_deployable (snapshot_h )
24592473
24602474 assert deployability_index .is_representative (snapshot_a )
24612475 assert deployability_index .is_representative (snapshot_e )
24622476 assert deployability_index .is_representative (snapshot_f )
2463- assert deployability_index .is_representative (snapshot_g )
24642477 assert not deployability_index .is_representative (snapshot_b )
24652478 assert not deployability_index .is_representative (snapshot_c )
24662479 assert not deployability_index .is_representative (snapshot_d )
2480+ assert not deployability_index .is_representative (snapshot_g )
2481+ assert not deployability_index .is_representative (snapshot_h )
24672482
24682483 all_deployable_index = deployability_index .all_deployable ()
24692484 assert all (all_deployable_index .is_deployable (s ) for s in snapshots .values ())
0 commit comments