@@ -1672,6 +1672,42 @@ def test_run_with_select_models(
16721672 }
16731673
16741674
1675+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
1676+ def test_seed_model_promote_to_prod_after_dev (
1677+ init_and_plan_context : t .Callable ,
1678+ ):
1679+ context , plan = init_and_plan_context ("examples/sushi" )
1680+ context .apply (plan )
1681+
1682+ with open (context .path / "seeds" / "waiter_names.csv" , "a" ) as f :
1683+ f .write ("\n 10,New Waiter" )
1684+
1685+ context .load ()
1686+
1687+ waiter_names_snapshot = context .get_snapshot ("sushi.waiter_names" )
1688+ plan = context .plan ("dev" , skip_tests = True , auto_apply = True , no_prompts = True )
1689+ assert waiter_names_snapshot .snapshot_id in plan .directly_modified
1690+
1691+ # Trigger a metadata change to reuse the previous version
1692+ waiter_names_model = waiter_names_snapshot .model .copy (
1693+ update = {"description" : "Updated description" }
1694+ )
1695+ context .upsert_model (waiter_names_model )
1696+ context .plan ("dev" , skip_tests = True , auto_apply = True , no_prompts = True )
1697+
1698+ # Promote all changes to prod
1699+ waiter_names_snapshot = context .get_snapshot ("sushi.waiter_names" )
1700+ plan = context .plan_builder ("prod" , skip_tests = True ).build ()
1701+ # Clear the cache to source the dehydrated model instance from the state
1702+ context .clear_caches ()
1703+ context .apply (plan )
1704+
1705+ assert (
1706+ context .engine_adapter .fetchone ("SELECT COUNT(*) FROM sushi.waiter_names WHERE id = 10" )[0 ]
1707+ == 1
1708+ )
1709+
1710+
16751711@time_machine .travel ("2023-01-08 15:00:00 UTC" )
16761712def test_plan_with_run (
16771713 init_and_plan_context : t .Callable ,
0 commit comments