File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
pubsub/tests/unit/pubsub_v1/subscriber Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import collections
1516import threading
1617
1718from google .cloud .pubsub_v1 import types
@@ -112,14 +113,15 @@ def test_ack_splitting_large_payload():
112113 assert len (calls ) == 3
113114
114115 all_ack_ids = {item .ack_id for item in items }
115- sent_ack_ids = set ()
116+ sent_ack_ids = collections . Counter ()
116117
117118 for call in calls :
118119 message = call .args [0 ]
119120 assert message .ByteSize () <= 524288 # server-side limit (2**19)
120121 sent_ack_ids .update (message .ack_ids )
121122
122- assert sent_ack_ids == all_ack_ids # all messages should have been ACK-ed
123+ assert set (sent_ack_ids ) == all_ack_ids # all messages should have been ACK-ed
124+ assert sent_ack_ids .most_common (1 )[0 ][1 ] == 1 # each message ACK-ed exactly once
123125
124126
125127def test_lease ():
@@ -197,14 +199,15 @@ def test_modify_ack_deadline_splitting_large_payload():
197199 assert len (calls ) == 3
198200
199201 all_ack_ids = {item .ack_id for item in items }
200- sent_ack_ids = set ()
202+ sent_ack_ids = collections . Counter ()
201203
202204 for call in calls :
203205 message = call .args [0 ]
204206 assert message .ByteSize () <= 524288 # server-side limit (2**19)
205207 sent_ack_ids .update (message .modify_deadline_ack_ids )
206208
207- assert sent_ack_ids == all_ack_ids # all messages should have been ACK-ed
209+ assert set (sent_ack_ids ) == all_ack_ids # all messages should have been ACK-ed
210+ assert sent_ack_ids .most_common (1 )[0 ][1 ] == 1 # each message ACK-ed exactly once
208211
209212
210213@mock .patch ("threading.Thread" , autospec = True )
You can’t perform that action at this time.
0 commit comments