Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging: unflake systests #5698

Merged
merged 3 commits into from
Jul 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions logging/tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,10 @@ def test_log_struct(self):
def test_log_handler_async(self):
LOG_MESSAGE = 'It was the worst of times'

handler = CloudLoggingHandler(Config.CLIENT)
handler_name = 'gcp-async' + unique_resource_id('-')
handler = CloudLoggingHandler(Config.CLIENT, name=handler_name)
# only create the logger to delete, hidden otherwise
logger = Config.CLIENT.logger(handler.name)
logger = Config.CLIENT.logger(handler_name)
self.to_delete.append(logger)

cloud_logger = logging.getLogger(handler.name)
Expand Down Expand Up @@ -334,14 +335,14 @@ def test_list_metrics(self):
METRIC_NAME, DEFAULT_FILTER, DEFAULT_DESCRIPTION)
self.assertFalse(metric.exists())
before_metrics = list(Config.CLIENT.list_metrics())
before_names = set(metric.name for metric in before_metrics)
before_names = set(before.name for before in before_metrics)
self.failIf(metric.name in before_names)
metric.create()
self.to_delete.append(metric)
self.assertTrue(metric.exists())
after_metrics = list(Config.CLIENT.list_metrics())
after_names = set(metric.name for metric in after_metrics)
self.assertEqual(after_names - before_names,
set([METRIC_NAME]))
after_names = set(after.name for after in after_metrics)
self.assertTrue(metric.name in after_names)

def test_reload_metric(self):
METRIC_NAME = 'test-reload-metric%s' % (_RESOURCE_ID,)
Expand Down Expand Up @@ -472,14 +473,14 @@ def test_list_sinks(self):
sink = Config.CLIENT.sink(SINK_NAME, DEFAULT_FILTER, uri)
self.assertFalse(sink.exists())
before_sinks = list(Config.CLIENT.list_sinks())
before_names = set(sink.name for sink in before_sinks)
before_names = set(before.name for before in before_sinks)
self.failIf(sink.name in before_names)
sink.create()
self.to_delete.append(sink)
self.assertTrue(sink.exists())
after_sinks = list(Config.CLIENT.list_sinks())
after_names = set(sink.name for sink in after_sinks)
self.assertEqual(after_names - before_names,
set([SINK_NAME]))
after_names = set(after.name for after in after_sinks)
self.assertTrue(sink.name in after_names)

def test_reload_sink(self):
SINK_NAME = 'test-reload-sink%s' % (_RESOURCE_ID,)
Expand Down