Merge pull request #420 from spulec/data-pipeline-improvements-2
Data pipeline improvements
This commit is contained in:
		
						commit
						ba4b58ed0d
					
				| @ -30,6 +30,10 @@ class Pipeline(object): | |||||||
|         self.objects = [] |         self.objects = [] | ||||||
|         self.status = "PENDING" |         self.status = "PENDING" | ||||||
| 
 | 
 | ||||||
|  |     @property | ||||||
|  |     def physical_resource_id(self): | ||||||
|  |         return self.pipeline_id | ||||||
|  | 
 | ||||||
|     def to_meta_json(self): |     def to_meta_json(self): | ||||||
|         return { |         return { | ||||||
|             "id": self.pipeline_id, |             "id": self.pipeline_id, | ||||||
|  | |||||||
| @ -31,9 +31,9 @@ class DataPipelineResponse(BaseResponse): | |||||||
|     def list_pipelines(self): |     def list_pipelines(self): | ||||||
|         pipelines = self.datapipeline_backend.list_pipelines() |         pipelines = self.datapipeline_backend.list_pipelines() | ||||||
|         return json.dumps({ |         return json.dumps({ | ||||||
|             "HasMoreResults": False, |             "hasMoreResults": False, | ||||||
|             "Marker": None, |             "marker": None, | ||||||
|             "PipelineIdList": [ |             "pipelineIdList": [ | ||||||
|                 pipeline.to_meta_json() for pipeline in pipelines |                 pipeline.to_meta_json() for pipeline in pipelines | ||||||
|             ] |             ] | ||||||
|         }) |         }) | ||||||
| @ -43,7 +43,7 @@ class DataPipelineResponse(BaseResponse): | |||||||
|         pipelines = self.datapipeline_backend.describe_pipelines(pipeline_ids) |         pipelines = self.datapipeline_backend.describe_pipelines(pipeline_ids) | ||||||
| 
 | 
 | ||||||
|         return json.dumps({ |         return json.dumps({ | ||||||
|             "PipelineDescriptionList": [ |             "pipelineDescriptionList": [ | ||||||
|                 pipeline.to_json() for pipeline in pipelines |                 pipeline.to_json() for pipeline in pipelines | ||||||
|             ] |             ] | ||||||
|         }) |         }) | ||||||
| @ -67,11 +67,10 @@ class DataPipelineResponse(BaseResponse): | |||||||
|         object_ids = self.parameters["objectIds"] |         object_ids = self.parameters["objectIds"] | ||||||
| 
 | 
 | ||||||
|         pipeline_objects = self.datapipeline_backend.describe_objects(object_ids, pipeline_id) |         pipeline_objects = self.datapipeline_backend.describe_objects(object_ids, pipeline_id) | ||||||
| 
 |  | ||||||
|         return json.dumps({ |         return json.dumps({ | ||||||
|             "HasMoreResults": False, |             "hasMoreResults": False, | ||||||
|             "Marker": None, |             "marker": None, | ||||||
|             "PipelineObjects": [ |             "pipelineObjects": [ | ||||||
|                 pipeline_object.to_json() for pipeline_object in pipeline_objects |                 pipeline_object.to_json() for pipeline_object in pipeline_objects | ||||||
|             ] |             ] | ||||||
|         }) |         }) | ||||||
|  | |||||||
| @ -1462,7 +1462,7 @@ def test_datapipeline(): | |||||||
|     } |     } | ||||||
|     cf_conn = boto.cloudformation.connect_to_region("us-east-1") |     cf_conn = boto.cloudformation.connect_to_region("us-east-1") | ||||||
|     template_json = json.dumps(dp_template) |     template_json = json.dumps(dp_template) | ||||||
|     cf_conn.create_stack( |     stack_id = cf_conn.create_stack( | ||||||
|         "test_stack", |         "test_stack", | ||||||
|         template_body=template_json, |         template_body=template_json, | ||||||
|     ) |     ) | ||||||
| @ -1470,5 +1470,9 @@ def test_datapipeline(): | |||||||
|     dp_conn = boto.datapipeline.connect_to_region('us-east-1') |     dp_conn = boto.datapipeline.connect_to_region('us-east-1') | ||||||
|     data_pipelines = dp_conn.list_pipelines() |     data_pipelines = dp_conn.list_pipelines() | ||||||
| 
 | 
 | ||||||
|     data_pipelines['PipelineIdList'].should.have.length_of(1) |     data_pipelines['pipelineIdList'].should.have.length_of(1) | ||||||
|     data_pipelines['PipelineIdList'][0]['name'].should.equal('testDataPipeline') |     data_pipelines['pipelineIdList'][0]['name'].should.equal('testDataPipeline') | ||||||
|  | 
 | ||||||
|  |     stack_resources = cf_conn.list_stack_resources(stack_id) | ||||||
|  |     stack_resources.should.have.length_of(1) | ||||||
|  |     stack_resources[0].physical_resource_id.should.equal(data_pipelines['pipelineIdList'][0]['id']) | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ def test_create_pipeline(): | |||||||
|     res = conn.create_pipeline("mypipeline", "some-unique-id") |     res = conn.create_pipeline("mypipeline", "some-unique-id") | ||||||
| 
 | 
 | ||||||
|     pipeline_id = res["pipelineId"] |     pipeline_id = res["pipelineId"] | ||||||
|     pipeline_descriptions = conn.describe_pipelines([pipeline_id])["PipelineDescriptionList"] |     pipeline_descriptions = conn.describe_pipelines([pipeline_id])["pipelineDescriptionList"] | ||||||
|     pipeline_descriptions.should.have.length_of(1) |     pipeline_descriptions.should.have.length_of(1) | ||||||
| 
 | 
 | ||||||
|     pipeline_description = pipeline_descriptions[0] |     pipeline_description = pipeline_descriptions[0] | ||||||
| @ -105,7 +105,7 @@ def test_describing_pipeline_objects(): | |||||||
| 
 | 
 | ||||||
|     conn.put_pipeline_definition(PIPELINE_OBJECTS, pipeline_id) |     conn.put_pipeline_definition(PIPELINE_OBJECTS, pipeline_id) | ||||||
| 
 | 
 | ||||||
|     objects = conn.describe_objects(["Schedule", "Default"], pipeline_id)['PipelineObjects'] |     objects = conn.describe_objects(["Schedule", "Default"], pipeline_id)['pipelineObjects'] | ||||||
| 
 | 
 | ||||||
|     objects.should.have.length_of(2) |     objects.should.have.length_of(2) | ||||||
|     default_object = [x for x in objects if x['id'] == 'Default'][0] |     default_object = [x for x in objects if x['id'] == 'Default'][0] | ||||||
| @ -125,7 +125,7 @@ def test_activate_pipeline(): | |||||||
|     pipeline_id = res["pipelineId"] |     pipeline_id = res["pipelineId"] | ||||||
|     conn.activate_pipeline(pipeline_id) |     conn.activate_pipeline(pipeline_id) | ||||||
| 
 | 
 | ||||||
|     pipeline_descriptions = conn.describe_pipelines([pipeline_id])["PipelineDescriptionList"] |     pipeline_descriptions = conn.describe_pipelines([pipeline_id])["pipelineDescriptionList"] | ||||||
|     pipeline_descriptions.should.have.length_of(1) |     pipeline_descriptions.should.have.length_of(1) | ||||||
|     pipeline_description = pipeline_descriptions[0] |     pipeline_description = pipeline_descriptions[0] | ||||||
|     fields = pipeline_description['fields'] |     fields = pipeline_description['fields'] | ||||||
| @ -141,14 +141,14 @@ def test_listing_pipelines(): | |||||||
| 
 | 
 | ||||||
|     response = conn.list_pipelines() |     response = conn.list_pipelines() | ||||||
| 
 | 
 | ||||||
|     response["HasMoreResults"].should.be(False) |     response["hasMoreResults"].should.be(False) | ||||||
|     response["Marker"].should.be.none |     response["marker"].should.be.none | ||||||
|     response["PipelineIdList"].should.have.length_of(2) |     response["pipelineIdList"].should.have.length_of(2) | ||||||
|     response["PipelineIdList"].should.contain({ |     response["pipelineIdList"].should.contain({ | ||||||
|         "id": res1["pipelineId"], |         "id": res1["pipelineId"], | ||||||
|         "name": "mypipeline1", |         "name": "mypipeline1", | ||||||
|     }) |     }) | ||||||
|     response["PipelineIdList"].should.contain({ |     response["pipelineIdList"].should.contain({ | ||||||
|         "id": res2["pipelineId"], |         "id": res2["pipelineId"], | ||||||
|         "name": "mypipeline2" |         "name": "mypipeline2" | ||||||
|     }) |     }) | ||||||
|  | |||||||
| @ -23,5 +23,5 @@ def test_list_streams(): | |||||||
| 
 | 
 | ||||||
|     json_data = json.loads(res.data.decode("utf-8")) |     json_data = json.loads(res.data.decode("utf-8")) | ||||||
|     json_data.should.equal({ |     json_data.should.equal({ | ||||||
|         'PipelineDescriptionList': [] |         'pipelineDescriptionList': [] | ||||||
|     }) |     }) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user