Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System test failures cleaning up backups #198

Closed
c24t opened this issue Dec 21, 2020 · 0 comments · Fixed by #199
Closed

System test failures cleaning up backups #198

c24t opened this issue Dec 21, 2020 · 0 comments · Fixed by #199
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API. triage me I really want to be triaged.

Comments

@c24t
Copy link
Contributor

c24t commented Dec 21, 2020

instance.list_backups fails at this line:

for backup in instance.list_backups():

because instance is the protobuf type google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.Instance instead of google.cloud.spanner_v1.instance.Instance. This is causing the following error in CI:

During handling of the above exception, another exception occurred:

    def setUpModule():
        if USE_EMULATOR:
            from google.auth.credentials import AnonymousCredentials

            emulator_project = os.getenv("GCLOUD_PROJECT", "emulator-test-project")
            Config.CLIENT = Client(
                project=emulator_project, credentials=AnonymousCredentials()
            )
        else:
            Config.CLIENT = Client()
        retry = RetryErrors(exceptions.ServiceUnavailable)

        configs = list(retry(Config.CLIENT.list_instance_configs)())

        instances = retry(_list_instances)()
        EXISTING_INSTANCES[:] = instances

        # Delete test instances that are older than an hour.
        cutoff = int(time.time()) - 1 * 60 * 60
        for instance in Config.CLIENT.list_instances("labels.python-spanner-systests:true"):
            if "created" not in instance.labels:
                continue
            create_time = int(instance.labels["created"])
            if create_time > cutoff:
                continue
            # Instance cannot be deleted while backups exist.
>           for backup in instance.list_backups():

tests/system/test_system.py:125:

See e.g. this failing test run.

It looks like it was introduced in #195, but the tests passed for that PR. The API changes to list_instances and list_backups that would have caused this happened back in #147 (see https://github.com/googleapis/python-spanner/pull/147/files#diff-f9e7537fc73135ee5d350541c1147e8ce8c71c505b01c9ea1187f9ee80540b19R328-R356), so I'm not sure why we're only seeing this issue now.

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Dec 21, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 22, 2020
@c24t c24t closed this as completed in #199 Dec 22, 2020
c24t added a commit that referenced this issue Dec 22, 2020
Fixes #198, includes #201.

Fix a bug in test_system.py around backup instance proto conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. triage me I really want to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants