File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
pytest==6.2.5
2
+ flaky==3.7.0
2
3
google-cloud-storage==1.43.0
Original file line number Diff line number Diff line change 15
15
import typing
16
16
import uuid
17
17
18
+ from flaky import flaky
18
19
import google .auth
19
20
import google .cloud .storage as storage
20
21
import pytest
@@ -38,6 +39,7 @@ def temp_bucket():
38
39
bucket .delete (force = True )
39
40
40
41
42
+ @flaky (max_runs = 3 )
41
43
def test_set_usage_export_bucket_default (
42
44
capsys : typing .Any , temp_bucket : storage .Bucket
43
45
) -> None :
Original file line number Diff line number Diff line change 14
14
import time
15
15
import uuid
16
16
17
+ import google .api_core .exceptions
17
18
import google .auth
18
19
from google .cloud import compute_v1
19
20
import pytest
@@ -52,8 +53,15 @@ def firewall_rule():
52
53
53
54
yield firewall_client .get (project = PROJECT , firewall = firewall_rule .name )
54
55
55
- op = firewall_client .delete (project = PROJECT , firewall = firewall_rule .name )
56
- op_client .wait (project = PROJECT , operation = op .name )
56
+ try :
57
+ op = firewall_client .delete (project = PROJECT , firewall = firewall_rule .name )
58
+ op_client .wait (project = PROJECT , operation = op .name )
59
+ except google .api_core .exceptions .BadRequest as err :
60
+ if err .code == 400 and "is not ready" in err .message :
61
+ # This means GCE enforcer has already deleted that rule.
62
+ pass
63
+ else :
64
+ raise err
57
65
58
66
59
67
def test_create_delete ():
You can’t perform that action at this time.
0 commit comments