Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/datapipeline/test_list_runs.py
1567 views
1
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
from awscli.testutils import BaseAWSCommandParamsTest
14
15
16
class TestDataPipelineQueryObjects(BaseAWSCommandParamsTest):
17
maxDiff = None
18
19
prefix = 'datapipeline list-runs '
20
21
def _generate_pipeline_objects(self, object_ids):
22
objects = []
23
for object_id in object_ids:
24
objects.append({
25
'id': object_id,
26
'name': object_id,
27
'fields': [
28
{'key': '@componentParent', 'stringValue': object_id}
29
]
30
})
31
return objects
32
33
def test_list_more_than_one_hundred_runs(self):
34
start_date = '2017-10-22T00:37:21'
35
end_date = '2017-10-26T00:37:21'
36
pipeline_id = 'pipeline-id'
37
args = '--pipeline-id %s --start-interval %s,%s' % (
38
pipeline_id, start_date, end_date
39
)
40
command = self.prefix + args
41
object_ids = ['object-id-%s' % i for i in range(150)]
42
objects = self._generate_pipeline_objects(object_ids)
43
44
self.parsed_responses = [
45
{
46
'ids': object_ids[:100],
47
'hasMoreResults': True,
48
'marker': 'marker'
49
},
50
{
51
'ids': object_ids[100:],
52
'hasMoreResults': False
53
},
54
{'pipelineObjects': objects[:100]},
55
{'pipelineObjects': objects[100:]}
56
]
57
58
self.run_cmd(command, expected_rc=None)
59
60
query = {
61
'selectors': [{
62
'fieldName': '@actualStartTime',
63
'operator': {
64
'type': 'BETWEEN',
65
'values': [start_date, end_date]
66
}
67
}]
68
}
69
70
expected_operations_called = [
71
('QueryObjects', {
72
'pipelineId': pipeline_id,
73
'query': query, 'sphere': 'INSTANCE'
74
}),
75
('QueryObjects', {
76
'pipelineId': pipeline_id,
77
'marker': 'marker', 'query': query, 'sphere': 'INSTANCE'
78
}),
79
('DescribeObjects', {
80
'objectIds': object_ids[:100],
81
'pipelineId': pipeline_id
82
}),
83
('DescribeObjects', {
84
'objectIds': object_ids[100:],
85
'pipelineId': pipeline_id
86
})
87
]
88
operations_called = [(op.name, params)
89
for op, params in self.operations_called]
90
self.assertEqual(expected_operations_called, operations_called)
91
92