2323
2424# pylint:disable=redefined-outer-name
2525# pylint:disable=unused-argument
26- #pylint: disable-msg=too-many-locals
26+ # pylint: disable-msg=too-many-locals
2727
2828
2929import os
@@ -53,6 +53,7 @@ def pipelines_api():
5353 def server_response (* args , ** kwargs ):
5454 if args [0 ] == 'GET' :
5555 return {'pipeline_id' : PIPELINE_ID , 'state' : 'RUNNING' }
56+
5657 client_mock .perform_query = mock .MagicMock (side_effect = server_response )
5758 _pipelines_api = api .PipelinesApi (client_mock )
5859 yield _pipelines_api
@@ -101,6 +102,7 @@ def test_deploy(put_file_mock, dbfs_path_validate, pipelines_api, tmpdir):
101102 with open (wheel1 , 'w' ) as f :
102103 f .write ('456' )
103104 libraries = [{'jar' : 'dbfs:/pipelines/code/file.jar' },
105+ {'maven' : {'coordinates' : 'com.org.name:package:0.1.0' }},
104106 {'jar' : jar1 },
105107 {'jar' : jar2 },
106108 {'jar' : jar3_relpath },
@@ -111,19 +113,20 @@ def test_deploy(put_file_mock, dbfs_path_validate, pipelines_api, tmpdir):
111113 expected_spec = copy .deepcopy (SPEC )
112114 expected_spec ['libraries' ] = [
113115 {'jar' : 'dbfs:/pipelines/code/file.jar' },
116+ {'maven' : {'coordinates' : 'com.org.name:package:0.1.0' }},
114117 {'jar' : 'dbfs:/pipelines/code/40bd001563085fc35165329ea1ff5c5ecbdbbeef.jar' },
115118 {'jar' : 'dbfs:/pipelines/code/51eac6b471a284d3341d8c0c63d0f1a286262a18.jar' },
116119 {'jar' : 'dbfs:/pipelines/code/51eac6b471a284d3341d8c0c63d0f1a286262a18.jar' },
117120 {'jar' : 'dbfs:/pipelines/code/51eac6b471a284d3341d8c0c63d0f1a286262a18.jar' },
118121 {'whl' :
119- 'dbfs:/pipelines/code/51eac6b471a284d3341d8c0c63d0f1a286262a18/wheel-name-conv.whl' }
122+ 'dbfs:/pipelines/code/51eac6b471a284d3341d8c0c63d0f1a286262a18/wheel-name-conv.whl' }
120123 ]
121124
122125 pipelines_api .deploy (spec )
123126 assert dbfs_path_validate .call_count == 5
124127 assert put_file_mock .call_count == 4
125128 assert put_file_mock .call_args_list [0 ][0 ][0 ] == jar2
126- assert put_file_mock .call_args_list [0 ][0 ][1 ].absolute_path == \
129+ assert put_file_mock .call_args_list [0 ][0 ][1 ].absolute_path == \
127130 'dbfs:/pipelines/code/51eac6b471a284d3341d8c0c63d0f1a286262a18.jar'
128131 assert put_file_mock .call_args_list [1 ][0 ][0 ] == jar3_relpath
129132 assert put_file_mock .call_args_list [2 ][0 ][0 ] == jar4
@@ -155,7 +158,7 @@ def test_get(pipelines_api):
155158 client_mock = pipelines_api .client .client .perform_query
156159 assert client_mock .call_count == 1
157160 client_mock .assert_called_with ('GET' , '/pipelines/' + PIPELINE_ID , data = {}, headers = None )
158- assert (response ['pipeline_id' ] == PIPELINE_ID and response ['state' ] == 'RUNNING' )
161+ assert (response ['pipeline_id' ] == PIPELINE_ID and response ['state' ] == 'RUNNING' )
159162
160163
161164def test_reset (pipelines_api ):
@@ -182,7 +185,8 @@ def test_partition_local_remote(pipelines_api):
182185 LibraryObject ('jar' , 'scheme:file.ext' ),
183186 LibraryObject ('jar' , 'scheme:/abs/path.ext' ),
184187 LibraryObject ('jar' , 'scheme://abs/path.ext' ),
185- LibraryObject ('egg' , 'file:/abs/path.ext' )
188+ LibraryObject ('egg' , 'file:/abs/path.ext' ),
189+ LibraryObject ('maven' , {'coordinates' : 'com.org.name:package:0.1.0' })
186190 ]
187191 expected_llo = [
188192 LibraryObject ('jar' , '/absolute/path/abc.ext' ),
@@ -199,7 +203,8 @@ def test_partition_local_remote(pipelines_api):
199203 LibraryObject ('jar' , 'scheme:file.ext' ),
200204 LibraryObject ('jar' , 'scheme:/abs/path.ext' ),
201205 LibraryObject ('jar' , 'scheme://abs/path.ext' ),
202- LibraryObject ('egg' , 'file:/abs/path.ext' )
206+ LibraryObject ('egg' , 'file:/abs/path.ext' ),
207+ LibraryObject ('maven' , {'coordinates' : 'com.org.name:package:0.1.0' })
203208 ]
204209 llo , external = pipelines_api ._identify_local_libraries (libraries )
205210 assert llo == expected_llo
@@ -215,7 +220,11 @@ def test_library_object_serialization_deserialization():
215220 {'egg' : 'FiLe:/weird/case.ext' },
216221 {'whl' : 'file.ext' },
217222 {'whl' : 's3:/s3/path/file.ext' },
218- {'jar' : 'dbfs:/dbfs/path/file.ext' }
223+ {'jar' : 'dbfs:/dbfs/path/file.ext' },
224+ {'maven' : {'coordinates' : 'com.org.name:package:0.1.0' }},
225+ {'maven' : {
226+ 'coordinates' : 'com.org.name:package:0.1.0' ,
227+ 'exclusions' : ['slf4j:slf4j' , '*:hadoop-client' ]}}
219228 ]
220229 library_objects = [
221230 LibraryObject ('jar' , '/absolute/path/abc.ext' ),
@@ -225,7 +234,11 @@ def test_library_object_serialization_deserialization():
225234 LibraryObject ('egg' , 'FiLe:/weird/case.ext' ),
226235 LibraryObject ('whl' , 'file.ext' ),
227236 LibraryObject ('whl' , 's3:/s3/path/file.ext' ),
228- LibraryObject ('jar' , 'dbfs:/dbfs/path/file.ext' )
237+ LibraryObject ('jar' , 'dbfs:/dbfs/path/file.ext' ),
238+ LibraryObject ('maven' , {'coordinates' : 'com.org.name:package:0.1.0' }),
239+ LibraryObject ('maven' , {
240+ 'coordinates' : 'com.org.name:package:0.1.0' ,
241+ 'exclusions' : ['slf4j:slf4j' , '*:hadoop-client' ]})
229242 ]
230243 llo = LibraryObject .from_json (libraries )
231244 assert llo == library_objects
0 commit comments