Uh oh!
There was an error while loading. Please reload this page.
Add error reporting system test - #3348
Conversation
| def setUp(self): | ||
| self._client = error_reporting.Client() | ||
| self._error_name = 'Stackdriver Error Reporting System Test' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| # exception, so first simulate it just to create the group | ||
| self._simulate_exception() | ||
| initial_count = self._get_error_count() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| return group.count | ||
| def test_report_exception(self): | ||
| """Verifies the exception reported increases the group count by one.""" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| from test_utils.retry import RetryResult | ||
| class _ErrorStatsGaxApi(object): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| """ | ||
| def __init__(self, project): | ||
| self._project = project | ||
| self._gax_api = error_stats_service_client.ErrorStatsServiceClient() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| from google.cloud.gapic.errorreporting.v1beta1 import ( | ||
| report_errors_service_client) | ||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| # Install all test dependencies, then install this package into the | ||
| # virtualenv's dist-packages. | ||
| session.install('flake8', *LOCAL_DEPS) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
waprin
commented
May 2, 2017
@dhermes still no hints as to why system tests are failing. I don't see the SSH option, wonder if you have any ideas why. |
waprin
commented
May 3, 2017
@dhermes mergeable? |
| # If test has never run, group won't exist until we report first | ||
| # exception, so first simulate it just to create the group | ||
| self._simulate_exception() | ||
| time.sleep(2) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| except RuntimeError: | ||
| Config.CLIENT.report_exception() | ||
| def _get_error_count(self): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| :type project: str | ||
| :param project: Google Cloud Project ID | ||
| """ | ||
| gax_api = error_stats_service_client.ErrorStatsServiceClient() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| project_name = gax_api.project_path(project) | ||
| time_range = error_stats_service_pb2.QueryTimeRange() | ||
| time_range.period = ( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| ) | ||
| duration = Duration() | ||
| duration.seconds = 60 * 60 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| return gax_api.list_group_stats( | ||
| project_name, time_range, timed_count_duration=duration) | ||
| ERROR_NAME = 'Stackdriver Error Reporting System Test' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| class TestErrorReporting(unittest.TestCase): | ||
| def _simulate_exception(self): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Also adding a retry until the count comes back as expected.
googlebot
commented
May 4, 2017
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
waprin
commented
May 4, 2017
lgtm |
This actually uses the gapic client to verify counts.
It doesn't expose the gapic client outside of the system methods since unlikely they will need to be used (and we can wait on the general gapic doc improvements for those who do want it).
Fixes#3335.