@@ -53,6 +53,15 @@ def test_pipeline_list_with_no_config():
53
53
assert len (crawler ) == 0
54
54
55
55
56
+ def test_include_pipeline_ids ():
57
+ ws = mock_workspace_client (pipeline_ids = ['empty-spec' , 'spec-with-spn' ])
58
+ crawler = PipelinesCrawler (ws , MockBackend (), "ucx" , include_pipeline_ids = ['empty-spec' ])
59
+ result_set = list (crawler .snapshot ())
60
+
61
+ assert len (result_set ) == 1
62
+ assert result_set [0 ].pipeline_id == 'empty-spec'
63
+
64
+
56
65
def test_pipeline_disappears_during_crawl (ws , mock_backend , caplog ) -> None :
57
66
"""Check that crawling doesn't fail if a pipeline is deleted after we list the pipelines but before we assess it."""
58
67
ws .pipelines .list_pipelines .return_value = (
@@ -63,7 +72,7 @@ def test_pipeline_disappears_during_crawl(ws, mock_backend, caplog) -> None:
63
72
def mock_get (pipeline_id : str ) -> GetPipelineResponse :
64
73
if pipeline_id == "2" :
65
74
raise ResourceDoesNotExist ("Simulated disappearance" )
66
- return GetPipelineResponse (pipeline_id = pipeline_id , spec = PipelineSpec (id = pipeline_id ))
75
+ return GetPipelineResponse (pipeline_id = pipeline_id , spec = PipelineSpec (id = pipeline_id ), name = "will_remain" )
67
76
68
77
ws .pipelines .get = mock_get
69
78
@@ -73,7 +82,7 @@ def mock_get(pipeline_id: str) -> GetPipelineResponse:
73
82
assert results == [
74
83
PipelineInfo (pipeline_id = "1" , pipeline_name = "will_remain" , creator_name = None , success = 1 , failures = "[]" )
75
84
]
76
- assert "Pipeline disappeared, cannot assess: will_disappear (id=2) " in caplog .messages
85
+ assert "Pipeline not found: 2 " in caplog .messages
77
86
78
87
79
88
def test_pipeline_crawler_creator ():
@@ -83,7 +92,12 @@ def test_pipeline_crawler_creator():
83
92
PipelineStateInfo (pipeline_id = "2" , creator_user_name = "" ),
84
93
PipelineStateInfo (pipeline_id = "3" , creator_user_name = "bob" ),
85
94
)
86
- ws .pipelines .get = create_autospec (GetPipelineResponse ) # pylint: disable=mock-no-usage
95
+ ws .pipelines .get = create_autospec (GetPipelineResponse )
96
+ ws .pipelines .get .side_effect = [
97
+ GetPipelineResponse (pipeline_id = "1" , spec = PipelineSpec (id = "1" ), creator_user_name = None ),
98
+ GetPipelineResponse (pipeline_id = "2" , spec = PipelineSpec (id = "2" ), creator_user_name = "" ),
99
+ GetPipelineResponse (pipeline_id = "3" , spec = PipelineSpec (id = "3" ), creator_user_name = "bob" ),
100
+ ]
87
101
result = PipelinesCrawler (ws , MockBackend (), "ucx" ).snapshot (force_refresh = True )
88
102
89
103
expected_creators = [None , None , "bob" ]
0 commit comments