Skip to content

Commit

Permalink
test: increase timeout and number of retries for system and sample te…
Browse files Browse the repository at this point in the history
…sts (#624)

Increasing instance deletion timeout to 2 hrs
Increasing instance creation retries to 8
  • Loading branch information
asthamohta committed Oct 21, 2021
1 parent b5a567f commit 55860b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions samples/samples/backup_sample.py
Expand Up @@ -38,7 +38,7 @@ def create_backup(instance_id, database_id, backup_id, version_time):
operation = backup.create()

# Wait for backup operation to complete.
operation.result(1200)
operation.result(2100)

# Verify that the backup is ready.
backup.reload()
Expand Down Expand Up @@ -74,7 +74,7 @@ def create_backup_with_encryption_key(instance_id, database_id, backup_id, kms_k
operation = backup.create()

# Wait for backup operation to complete.
operation.result(1200)
operation.result(2100)

# Verify that the backup is ready.
backup.reload()
Expand Down
2 changes: 1 addition & 1 deletion samples/samples/conftest.py
Expand Up @@ -24,7 +24,7 @@
import pytest
from test_utils import retry

INSTANCE_CREATION_TIMEOUT = 240 # seconds
INSTANCE_CREATION_TIMEOUT = 560 # seconds

retry_429 = retry.RetryErrors(exceptions.ResourceExhausted, delay=15)

Expand Down
8 changes: 4 additions & 4 deletions tests/system/_helpers.py
Expand Up @@ -34,10 +34,10 @@
SKIP_BACKUP_TESTS = os.getenv(SKIP_BACKUP_TESTS_ENVVAR) is not None

INSTANCE_OPERATION_TIMEOUT_IN_SECONDS = int(
os.getenv("SPANNER_INSTANCE_OPERATION_TIMEOUT_IN_SECONDS", 240)
os.getenv("SPANNER_INSTANCE_OPERATION_TIMEOUT_IN_SECONDS", 560)
)
DATABASE_OPERATION_TIMEOUT_IN_SECONDS = int(
os.getenv("SPANNER_DATABASE_OPERATION_TIMEOUT_IN_SECONDS", 60)
os.getenv("SPANNER_DATABASE_OPERATION_TIMEOUT_IN_SECONDS", 120)
)

USE_EMULATOR_ENVVAR = "SPANNER_EMULATOR_HOST"
Expand All @@ -57,7 +57,7 @@

retry_503 = retry.RetryErrors(exceptions.ServiceUnavailable)
retry_429_503 = retry.RetryErrors(
exceptions.TooManyRequests, exceptions.ServiceUnavailable,
exceptions.TooManyRequests, exceptions.ServiceUnavailable, 8
)
retry_mabye_aborted_txn = retry.RetryErrors(exceptions.ServerError, exceptions.Aborted)
retry_mabye_conflict = retry.RetryErrors(exceptions.ServerError, exceptions.Conflict)
Expand Down Expand Up @@ -107,7 +107,7 @@ def scrub_instance_ignore_not_found(to_scrub):


def cleanup_old_instances(spanner_client):
cutoff = int(time.time()) - 1 * 60 * 60 # one hour ago
cutoff = int(time.time()) - 2 * 60 * 60 # two hour ago
instance_filter = "labels.python-spanner-systests:true"

for instance_pb in spanner_client.list_instances(filter_=instance_filter):
Expand Down

0 comments on commit 55860b5

Please sign in to comment.