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

Add system test for 'Client.metric' / 'Metric.create'. #1610

Merged
merged 1 commit into from
Mar 18, 2016
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
13 changes: 12 additions & 1 deletion system_tests/logging_.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
from gcloud import logging


DEFAULT_LOGGER_NAME = 'system-tests-%d' % (1000 * time.time(),)
DEFAULT_LOGGER_NAME = 'system-tests-logger-%d' % (1000 * time.time(),)
DEFAULT_METRIC_NAME = 'system-tests-metric-%d' % (1000 * time.time(),)
DEFAULT_FILTER = 'logName:syslog AND severity>=INFO'
DEFAULT_DESCRIPTION = 'System testing'


class Config(object):
Expand Down Expand Up @@ -69,3 +72,11 @@ def test_log_struct(self):
entries, _ = logger.list_entries()
self.assertEqual(len(entries), 1)
self.assertEqual(entries[0].payload, JSON_PAYLOAD)

def test_create_metric(self):
metric = Config.CLIENT.metric(
DEFAULT_METRIC_NAME, DEFAULT_FILTER, DEFAULT_DESCRIPTION)
self.assertFalse(metric.exists())
metric.create()
self.to_delete.append(metric)
self.assertTrue(metric.exists())