Skip to content

Commit

Permalink
Add system test for 'Client.metric'/'Metric.create'.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Mar 17, 2016
1 parent 57fed8a commit 97be817
Showing 1 changed file with 12 additions and 1 deletion.
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())

0 comments on commit 97be817

Please sign in to comment.