Skip to content

GAX iter.next() pattern seems to be breaking down #2140

Description

@dhermes

For example, sometimes the iterable isn't an iterable

Traceback (mostrecentcalllast):
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/system_tests/logging_.py", line215, intest_update_metricafter_metrics, _=Config.CLIENT.list_metrics()
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests3/lib/python3.4/site-packages/gcloud/logging/client.py", line298, inlist_metricsself.project, page_size, page_token)
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests3/lib/python3.4/site-packages/gcloud/logging/_gax.py", line306, inlist_metricsforlog_metric_pbinpage_iter.next()]
TypeError: 'LogMetric'objectisnotiterable

or

Traceback (mostrecentcalllast):
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/system_tests/pubsub.py", line273, intest_fetch_delete_subscription_w_deleted_topicall_subs=retry_until_found_orphan(_fetch)()
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/system_tests/retry.py", line126, inwrapped_functionresult=to_wrap(*args, **kwargs)
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/system_tests/pubsub.py", line266, in_fetchreturnlist(MethodIterator(Config.CLIENT.list_subscriptions))
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/gcloud/iterator.py", line178, in__iter__page_token=self._token, page_size=self._page_size, **self._kw)
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/gcloud/pubsub/client.py", line164, inlist_subscriptionsself.project, page_size, page_token)
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/gcloud/pubsub/_gax.py", line242, inlist_subscriptionsforsub_pbinpage_iter.next()]
TypeError: 'Subscription'objectisnotiterable

and sometimes it just gives a StopIteration when a new page is expected

Traceback (mostrecentcalllast):
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/system_tests/pubsub.py", line130, intest_list_subscriptionsempty, _=topic.list_subscriptions()
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/gcloud/pubsub/topic.py", line314, inlist_subscriptionsself.full_name, page_size, page_token)
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/gcloud/pubsub/_gax.py", line198, intopic_list_subscriptionssubs=page_iter.next()
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/google/gax/__init__.py", line472, innextreturnself.__next__()
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/google/gax/__init__.py", line478, in__next__self._current=next(self._page_iterator)
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/google/gax/__init__.py", line435, innextreturnself.__next__()
File"/home/travis/build/GoogleCloudPlatform/gcloud-python/.tox/system-tests/lib/python2.7/site-packages/google/gax/__init__.py", line440, in__next__raiseStopIterationStopIteration

I withhold the flaky label because the same 10 test cases fail every time and in both Python 2 and 3:

  1. test_fetch_delete_subscription_w_deleted_topic (pubsub.TestPubsub)
  2. test_list_subscriptions (pubsub.TestPubsub)
  3. test_list_topics (pubsub.TestPubsub)
  4. test_list_metrics (logging_.TestLogging)
  5. test_list_sinks (logging_.TestLogging)
  6. test_log_struct (logging_.TestLogging)
  7. test_log_struct_w_metadata (logging_.TestLogging)
  8. test_log_text (logging_.TestLogging)
  9. test_log_text_w_metadata (logging_.TestLogging)
  10. test_update_metric (logging_.TestLogging)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions