@@ -3359,3 +3359,67 @@ def test_environment_statements_change_allows_dev_environment_creation(make_snap
33593359 assert plan is not None
33603360 assert plan .context_diff .has_environment_statements_changes
33613361 assert plan .context_diff .environment_statements == environment_statements
3362+
3363+
3364+ def test_plan_ignore_cron_flag (make_snapshot ):
3365+ """Test that ignore_cron flag is properly stored and propagated through plan objects."""
3366+
3367+ # Create a snapshot with a daily cron schedule
3368+ snapshot_a = make_snapshot (
3369+ SqlModel (
3370+ name = "test_model" ,
3371+ kind = IncrementalByTimeRangeKind (time_column = "ds" ),
3372+ cron = "@daily" , # Daily cron schedule
3373+ start = "2023-01-01" ,
3374+ query = parse_one ("SELECT 1 as id, ds FROM VALUES ('2023-01-01') t(ds)" ),
3375+ allow_partials = True ,
3376+ )
3377+ )
3378+
3379+ # Mock the context diff
3380+ context_diff = ContextDiff (
3381+ environment = "dev" ,
3382+ is_new_environment = True ,
3383+ is_unfinalized_environment = False ,
3384+ normalize_environment_name = True ,
3385+ create_from = "prod" ,
3386+ create_from_env_exists = True ,
3387+ added = set (),
3388+ removed_snapshots = {},
3389+ modified_snapshots = {},
3390+ snapshots = {snapshot_a .snapshot_id : snapshot_a },
3391+ new_snapshots = {snapshot_a .snapshot_id : snapshot_a },
3392+ previous_plan_id = None ,
3393+ previously_promoted_snapshot_ids = set (),
3394+ previous_finalized_snapshots = None ,
3395+ previous_gateway_managed_virtual_layer = False ,
3396+ gateway_managed_virtual_layer = False ,
3397+ environment_statements = [],
3398+ )
3399+
3400+ plan_builder_ignore_cron = PlanBuilder (
3401+ context_diff ,
3402+ start = "2023-01-01" ,
3403+ execution_time = "2023-01-05 12:00:00" ,
3404+ is_dev = True ,
3405+ include_unmodified = True ,
3406+ ignore_cron = True ,
3407+ end_bounded = False ,
3408+ )
3409+
3410+ plan = plan_builder_ignore_cron .build ()
3411+ assert plan .ignore_cron is True
3412+ assert plan .to_evaluatable ().ignore_cron is True
3413+
3414+ assert plan .missing_intervals == [
3415+ SnapshotIntervals (
3416+ snapshot_id = snapshot_a .snapshot_id ,
3417+ intervals = [
3418+ (to_timestamp ("2023-01-01" ), to_timestamp ("2023-01-02" )),
3419+ (to_timestamp ("2023-01-02" ), to_timestamp ("2023-01-03" )),
3420+ (to_timestamp ("2023-01-03" ), to_timestamp ("2023-01-04" )),
3421+ (to_timestamp ("2023-01-04" ), to_timestamp ("2023-01-05" )),
3422+ (to_timestamp ("2023-01-05" ), to_timestamp ("2023-01-05 12:00:00" )),
3423+ ],
3424+ )
3425+ ]
0 commit comments