File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed
Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 1616import random
1717import string
1818
19- from gcp_devrel . testing import eventually_consistent
19+ import backoff
2020from google .cloud import logging
2121import pytest
2222
2323import export
2424
25+
2526BUCKET = os .environ ['CLOUD_STORAGE_BUCKET' ]
2627TEST_SINK_NAME_TMPL = 'example_sink_{}'
2728TEST_SINK_FILTER = 'severity>=CRITICAL'
@@ -53,12 +54,14 @@ def example_sink():
5354
5455
5556def test_list (example_sink , capsys ):
56- @eventually_consistent . call
57- def _ ():
57+ @backoff . on_exception ( backoff . expo , AssertionError , max_time = 60 )
58+ def eventually_consistent_test ():
5859 export .list_sinks ()
5960 out , _ = capsys .readouterr ()
6061 assert example_sink .name in out
6162
63+ eventually_consistent_test ()
64+
6265
6366def test_create (capsys ):
6467 sink_name = TEST_SINK_NAME_TMPL .format (_random_id ())
Original file line number Diff line number Diff line change 1+ backoff==1.10.0
12pytest==5.3.2
2- gcp-devrel-py-tools==0.0.15
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from gcp_devrel . testing import eventually_consistent
15+ import backoff
1616from google .cloud import logging
1717import pytest
1818
1919import snippets
2020
21+
2122TEST_LOGGER_NAME = 'example_log'
2223
2324
@@ -31,18 +32,20 @@ def example_log():
3132
3233
3334def test_list (example_log , capsys ):
34- @eventually_consistent . call
35- def _ ():
35+ @backoff . on_exception ( backoff . expo , AssertionError , max_time = 120 )
36+ def eventually_consistent_test ():
3637 snippets .list_entries (TEST_LOGGER_NAME )
3738 out , _ = capsys .readouterr ()
3839 assert example_log in out
3940
41+ eventually_consistent_test ()
42+
4043
4144def test_write ():
4245 snippets .write_entry (TEST_LOGGER_NAME )
4346
4447
45- def test_delete (example_log ):
46- @ eventually_consistent . call
47- def _ ():
48- snippets . delete_logger ( TEST_LOGGER_NAME )
48+ def test_delete (example_log , capsys ):
49+ snippets . delete_logger ( TEST_LOGGER_NAME )
50+ out , _ = capsys . readouterr ()
51+ assert TEST_LOGGER_NAME in out
You can’t perform that action at this time.
0 commit comments