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 16
16
import random
17
17
import string
18
18
19
- from gcp_devrel . testing import eventually_consistent
19
+ import backoff
20
20
from google .cloud import logging
21
21
import pytest
22
22
23
23
import export
24
24
25
+
25
26
BUCKET = os .environ ['CLOUD_STORAGE_BUCKET' ]
26
27
TEST_SINK_NAME_TMPL = 'example_sink_{}'
27
28
TEST_SINK_FILTER = 'severity>=CRITICAL'
@@ -53,12 +54,14 @@ def example_sink():
53
54
54
55
55
56
def 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 ():
58
59
export .list_sinks ()
59
60
out , _ = capsys .readouterr ()
60
61
assert example_sink .name in out
61
62
63
+ eventually_consistent_test ()
64
+
62
65
63
66
def test_create (capsys ):
64
67
sink_name = TEST_SINK_NAME_TMPL .format (_random_id ())
Original file line number Diff line number Diff line change
1
+ backoff==1.10.0
1
2
pytest==5.3.2
2
- gcp-devrel-py-tools==0.0.15
Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- from gcp_devrel . testing import eventually_consistent
15
+ import backoff
16
16
from google .cloud import logging
17
17
import pytest
18
18
19
19
import snippets
20
20
21
+
21
22
TEST_LOGGER_NAME = 'example_log'
22
23
23
24
@@ -31,18 +32,20 @@ def example_log():
31
32
32
33
33
34
def 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 ():
36
37
snippets .list_entries (TEST_LOGGER_NAME )
37
38
out , _ = capsys .readouterr ()
38
39
assert example_log in out
39
40
41
+ eventually_consistent_test ()
42
+
40
43
41
44
def test_write ():
42
45
snippets .write_entry (TEST_LOGGER_NAME )
43
46
44
47
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