Skip to content

Commit 2796e1b

Browse files
authored
Merge pull request #10 from rsaksham-dev/main_pr_2
Main pr 2
2 parents 3e17368 + 4e74c47 commit 2796e1b

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

noxfile.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def system(session):
111111
"""Run the system test suite."""
112112
system_test_path = os.path.join("tests", "system.py")
113113
system_test_folder_path = os.path.join("tests", "system")
114+
rerun_count = 0
114115

115116
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
116117
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
@@ -121,6 +122,12 @@ def system(session):
121122
# mTLS tests requires pyopenssl.
122123
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "") == "true":
123124
session.install("pyopenssl")
125+
# Check if endpoint is being overriden for rerun_count
126+
if (
127+
os.getenv("API_ENDPOINT_OVERRIDE", "https://storage.googleapis.com")
128+
!= "https://storage.googleapis.com"
129+
):
130+
rerun_count = 3
124131

125132
system_test_exists = os.path.exists(system_test_path)
126133
system_test_folder_exists = os.path.exists(system_test_folder_path)
@@ -152,13 +159,17 @@ def system(session):
152159
# Run py.test against the system tests.
153160
if system_test_exists:
154161
session.run(
155-
"py.test", "--quiet", "--reruns=2", system_test_path, *session.posargs
162+
"py.test",
163+
"--quiet",
164+
"--reruns={}".format(rerun_count),
165+
system_test_path,
166+
*session.posargs,
156167
)
157168
if system_test_folder_exists:
158169
session.run(
159170
"py.test",
160171
"--quiet",
161-
"--reruns=2",
172+
"--reruns={}".format(rerun_count),
162173
system_test_folder_path,
163174
*session.posargs,
164175
)

tests/system/test_bucket.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def test_bucket_lifecycle_rules(storage_client, buckets_to_delete):
123123
assert list(bucket.lifecycle_rules) == []
124124

125125

126-
@pytest.mark.flaky(rerun_filter=_helpers.is_api_endpoint_override, reruns=4)
126+
@pytest.mark.skipif(
127+
_helpers.is_api_endpoint_override,
128+
reason="Test does not yet support endpoint override",
129+
)
127130
def test_bucket_update_labels(storage_client, buckets_to_delete):
128131
bucket_name = _helpers.unique_name("update-labels")
129132
bucket = _helpers.retry_429_503(storage_client.create_bucket)(bucket_name)
@@ -618,7 +621,6 @@ def test_bucket_list_blobs_hierarchy_w_include_trailing_delimiter(
618621
assert iterator.prefixes == expected_prefixes
619622

620623

621-
@pytest.mark.flaky(rerun_filter=_helpers.is_api_endpoint_override, reruns=4)
622624
def test_bucket_w_retention_period(
623625
storage_client,
624626
buckets_to_delete,
@@ -798,7 +800,10 @@ def test_bucket_lock_retention_policy(
798800
bucket.patch()
799801

800802

801-
@pytest.mark.flaky(rerun_filter=_helpers.is_api_endpoint_override, reruns=4)
803+
@pytest.mark.skipif(
804+
_helpers.is_api_endpoint_override,
805+
reason="Test does not yet support endpoint override",
806+
)
802807
def test_new_bucket_w_ubla(
803808
storage_client,
804809
buckets_to_delete,

0 commit comments

Comments
 (0)