Skip to content

Commit

Permalink
Merge pull request #1610 from tseaver/logging-system_test-metric_create
Browse files Browse the repository at this point in the history
Add system test for 'Client.metric' / 'Metric.create'.
  • Loading branch information
tseaver committed Mar 18, 2016
2 parents 57fed8a + 97be817 commit 93443d1
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 93443d1

Please sign in to comment.