Skip to content
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
25 changes: 22 additions & 3 deletions system_tests/logging_.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_update_metric(self):
self.assertEqual(after.filter_, NEW_FILTER)
self.assertEqual(after.description, NEW_DESCRIPTION)

def test_create_sink_storage_bucket(self):
def _init_storage_bucket(self):
from gcloud import storage
BUCKET_URI = 'storage.googleapis.com/%s' % (BUCKET_NAME,)

Expand All @@ -147,8 +147,12 @@ def test_create_sink_storage_bucket(self):
bucket.acl.add_entity(logs_group)
bucket.acl.save()

sink = Config.CLIENT.sink(
DEFAULT_SINK_NAME, DEFAULT_FILTER, BUCKET_URI)
return BUCKET_URI

def test_create_sink_storage_bucket(self):
uri = self._init_storage_bucket()

sink = Config.CLIENT.sink(DEFAULT_SINK_NAME, DEFAULT_FILTER, uri)
self.assertFalse(sink.exists())
sink.create()
self.to_delete.append(sink)
Expand Down Expand Up @@ -193,3 +197,18 @@ def test_reload_sink(self):
sink.reload()
self.assertEqual(sink.filter_, DEFAULT_FILTER)
self.assertEqual(sink.destination, uri)

def test_update_sink(self):
bucket_uri = self._init_storage_bucket()
dataset_uri = self._init_bigquery_dataset()
UPDATED_FILTER = 'logName:syslog'

This comment was marked as spam.

This comment was marked as spam.

sink = Config.CLIENT.sink(
DEFAULT_SINK_NAME, DEFAULT_FILTER, bucket_uri)
self.assertFalse(sink.exists())
sink.create()
self.to_delete.append(sink)
sink.filter_ = UPDATED_FILTER
sink.destination = dataset_uri
sink.update()
self.assertEqual(sink.filter_, UPDATED_FILTER)
self.assertEqual(sink.destination, dataset_uri)