@@ -182,7 +182,7 @@ def test_plan(runner, tmp_path):
182182 assert_plan_success (result )
183183 # 'Models needing backfill' section and eval progress bar should display the same inclusive intervals
184184 assert "sqlmesh_example.incremental_model: [2020-01-01 - 2022-12-31]" in result .output
185- assert "sqlmesh_example.incremental_model [insert 2020-01-01 - 2022-12-31]" in result .output
185+ assert "sqlmesh_example.incremental_model [insert 2020-01-01 - 2022-12-31]" in result .output
186186
187187
188188def test_plan_skip_tests (runner , tmp_path ):
@@ -243,7 +243,7 @@ def test_plan_restate_model(runner, tmp_path):
243243 assert result .exit_code == 0
244244 assert_duckdb_test (result )
245245 assert "No changes to plan: project files match the `prod` environment" in result .output
246- assert "sqlmesh_example.full_model [full refresh" in result .output
246+ assert "sqlmesh_example.full_model [full refresh" in result .output
247247 assert_model_batches_executed (result )
248248 assert_virtual_layer_updated (result )
249249
@@ -553,6 +553,56 @@ def test_plan_dev_no_changes(runner, tmp_path):
553553 assert_virtual_layer_updated (result )
554554
555555
556+ def test_plan_dev_longnames (runner , tmp_path ):
557+ create_example_project (tmp_path )
558+
559+ long_model_names = {
560+ "full" : f"full_{ 'a' * 80 } " ,
561+ "incremental" : f"incremental_{ 'b' * 80 } " ,
562+ "seed" : f"seed_{ 'c' * 80 } " ,
563+ }
564+ for model_name in long_model_names :
565+ with open (tmp_path / "models" / f"{ model_name } _model.sql" , "r" ) as f :
566+ model_text = f .read ()
567+ for more_model_names in long_model_names :
568+ model_text = model_text .replace (
569+ f"sqlmesh_example.{ more_model_names } _model" ,
570+ f"sqlmesh_example.{ long_model_names [more_model_names ]} _model" ,
571+ )
572+ with open (tmp_path / "models" / f"{ model_name } _model.sql" , "w" ) as f :
573+ f .write (model_text )
574+
575+ # Input: `y` to apply and backfill
576+ result = runner .invoke (
577+ cli ,
578+ [
579+ "--log-file-dir" ,
580+ tmp_path ,
581+ "--paths" ,
582+ tmp_path ,
583+ "plan" ,
584+ "dev_butamuchlongerenvironmentname" ,
585+ "--skip-tests" ,
586+ "--no-prompts" ,
587+ "--auto-apply" ,
588+ ],
589+ )
590+ assert result .exit_code == 0
591+ assert (
592+ "sqlmesh_example__dev_butamuchlongerenvironmentname.seed_cccccccccccccccccccccccc\n cccccccccccccccccccccccccccccccccccccccccccccccccccccccc_model [insert \n seed file]"
593+ in result .output
594+ )
595+ assert (
596+ "sqlmesh_example__dev_butamuchlongerenvironmentname.incremental_bbbbbbbbbbbbbbbbb\n bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb_model [insert "
597+ in result .output
598+ )
599+ assert (
600+ "sqlmesh_example__dev_butamuchlongerenvironmentname.full_aaaaaaaaaaaaaaaaaaaaaaaa\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_model [full \n refresh"
601+ in result .output
602+ )
603+ assert_backfill_success (result )
604+
605+
556606def test_plan_nonbreaking (runner , tmp_path ):
557607 create_example_project (tmp_path )
558608 init_prod_and_backfill (runner , tmp_path )
@@ -568,8 +618,8 @@ def test_plan_nonbreaking(runner, tmp_path):
568618 assert "+ 'a' AS new_col" in result .output
569619 assert "Directly Modified: sqlmesh_example.incremental_model (Non-breaking)" in result .output
570620 assert "sqlmesh_example.full_model (Indirect Non-breaking)" in result .output
571- assert "sqlmesh_example.incremental_model [insert" in result .output
572- assert "sqlmesh_example.full_model [full refresh" not in result .output
621+ assert "sqlmesh_example.incremental_model [insert" in result .output
622+ assert "sqlmesh_example.full_model [full refresh" not in result .output
573623 assert_backfill_success (result )
574624
575625
@@ -626,8 +676,8 @@ def test_plan_breaking(runner, tmp_path):
626676 assert result .exit_code == 0
627677 assert "+ item_id + 1 AS item_id," in result .output
628678 assert "Directly Modified: sqlmesh_example.full_model (Breaking)" in result .output
629- assert "sqlmesh_example.full_model [full refresh" in result .output
630- assert "sqlmesh_example.incremental_model [insert" not in result .output
679+ assert "sqlmesh_example.full_model [full refresh" in result .output
680+ assert "sqlmesh_example.incremental_model [insert" not in result .output
631681 assert_backfill_success (result )
632682
633683
@@ -665,8 +715,8 @@ def test_plan_dev_select(runner, tmp_path):
665715 assert "+ item_id + 1 AS item_id," not in result .output
666716 assert "Directly Modified: sqlmesh_example__dev.full_model (Breaking)" not in result .output
667717 # only incremental_model backfilled
668- assert "sqlmesh_example__dev.incremental_model [insert" in result .output
669- assert "sqlmesh_example__dev.full_model [full refresh" not in result .output
718+ assert "sqlmesh_example__dev.incremental_model [insert" in result .output
719+ assert "sqlmesh_example__dev.full_model [full refresh" not in result .output
670720 assert_backfill_success (result )
671721
672722
@@ -704,8 +754,8 @@ def test_plan_dev_backfill(runner, tmp_path):
704754 "Directly Modified: sqlmesh_example__dev.incremental_model (Non-breaking)" in result .output
705755 )
706756 # only incremental_model backfilled
707- assert "sqlmesh_example__dev.incremental_model [insert" in result .output
708- assert "sqlmesh_example__dev.full_model [full refresh" not in result .output
757+ assert "sqlmesh_example__dev.incremental_model [insert" in result .output
758+ assert "sqlmesh_example__dev.full_model [full refresh" not in result .output
709759 assert_backfill_success (result )
710760
711761
0 commit comments