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