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

Storage: 'test_blob_w_explicit_kms_key_name' flake w/ extra blobs #7478

Closed
tseaver opened this issue Mar 4, 2019 · 0 comments
Closed

Storage: 'test_blob_w_explicit_kms_key_name' flake w/ extra blobs #7478

tseaver opened this issue Mar 4, 2019 · 0 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. flaky testing type: process A process-related concern. May include testing, release, or the like.

Comments

@tseaver
Copy link
Contributor

tseaver commented Mar 4, 2019

From this CI job last week, failing both for 2.7 and 3.6:

_____________ TestKMSIntegration.test_blob_w_explicit_kms_key_name _____________
self = <tests.system.TestKMSIntegration testMethod=test_blob_w_explicit_kms_key_name>
    def test_blob_w_explicit_kms_key_name(self):
        BLOB_NAME = "explicit-kms-key-name"
        file_data = self.FILES["simple"]
        kms_key_name = self._kms_key_name()
        blob = self.bucket.blob(BLOB_NAME, kms_key_name=kms_key_name)
        blob.upload_from_filename(file_data["path"])
        self.case_blobs_to_delete.append(blob)
        with open(file_data["path"], "rb") as _file_data:
            self.assertEqual(blob.download_as_string(), _file_data.read())
        # We don't know the current version of the key.
        self.assertTrue(blob.kms_key_name.startswith(kms_key_name))
>       listed, = list(self.bucket.list_blobs())
E ValueError: too many values to unpack (expected 1)

Note that the tearDownModule failed as well (in both Python versions):

_______ ERROR at teardown of TestIAMConfiguration.test_new_bucket_w_bpo ________
    def tearDownModule():
        errors = (exceptions.Conflict, exceptions.TooManyRequests)
        retry = RetryErrors(errors, max_tries=6)
>       retry(Config.TEST_BUCKET.delete)(force=True)
tests/system.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../test_utils/test_utils/retry.py:108: in wrapped_function
    return to_wrap(*args, **kwargs)
google/cloud/storage/bucket.py:889: in delete
    _target_object=None,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <google.cloud.storage._http.Connection object at 0x7faf642ab630>
method = 'DELETE', path = '/b/new_1551137519988', query_params = {}, data = None
content_type = None, headers = None, api_base_url = None, api_version = None
expect_json = True, _target_object = None
    def api_request(
        self,
        method,
        path,
        query_params=None,
        data=None,
        content_type=None,
        headers=None,
        api_base_url=None,
        api_version=None,
        expect_json=True,
        _target_object=None,
    ):
        """Make a request over the HTTP transport to the API.
        You shouldn't need to use this method, but if you plan to
        interact with the API using these primitives, this is the
        correct one to use.
        :type method: str
        :param method: The HTTP method name (ie, ``GET``, ``POST``, etc).
                       Required.
        :type path: str
        :param path: The path to the resource (ie, ``'/b/bucket-name'``).
                     Required.
        :type query_params: dict or list
        :param query_params: A dictionary of keys and values (or list of
                             key-value pairs) to insert into the query
                             string of the URL.
        :type data: str
        :param data: The data to send as the body of the request. Default is
                     the empty string.
        :type content_type: str
        :param content_type: The proper MIME type of the data provided. Default
                             is None.
        :type headers: dict
        :param headers: extra HTTP headers to be sent with the request.
        :type api_base_url: str
        :param api_base_url: The base URL for the API endpoint.
                             Typically you won't have to provide this.
                             Default is the standard API base URL.
        :type api_version: str
        :param api_version: The version of the API to call.  Typically
                            you shouldn't provide this and instead use
                            the default for the library.  Default is the
                            latest API version supported by
                            google-cloud-python.
        :type expect_json: bool
        :param expect_json: If True, this method will try to parse the
                            response as JSON and raise an exception if
                            that cannot be done.  Default is True.
        :type _target_object: :class:`object`
        :param _target_object:
            (Optional) Protected argument to be used by library callers. This
            can allow custom behavior, for example, to defer an HTTP request
            and complete initialization of the object at a later time.
        :raises ~google.cloud.exceptions.GoogleCloudError: if the response code
            is not 200 OK.
        :raises ValueError: if the response content type is not JSON.
        :rtype: dict or str
        :returns: The API response payload, either as a raw string or
                  a dictionary if the response is valid JSON.
        """
        url = self.build_api_url(
            path=path,
            query_params=query_params,
            api_base_url=api_base_url,
            api_version=api_version,
        )
        # Making the executive decision that any dictionary
        # data will be sent properly as JSON.
        if data and isinstance(data, dict):
            data = json.dumps(data)
            content_type = "application/json"
        response = self._make_request(
            method=method,
            url=url,
            data=data,
            content_type=content_type,
            headers=headers,
            target_object=_target_object,
        )
        if not 200 <= response.status_code < 300:
>           raise exceptions.from_http_response(response)
E           google.api_core.exceptions.Conflict: 409 DELETE https://www.googleapis.com/storage/v1/b/new_1551137519988: The bucket you tried to delete was not empty.
../core/google/cloud/_http.py:319: Conflict
@tseaver tseaver added api: storage Issues related to the Cloud Storage API. testing type: process A process-related concern. May include testing, release, or the like. flaky labels Mar 4, 2019
@tseaver tseaver changed the title Storage: 'TestKMSIntegration testMethod=test_blob_w_explicit_kms_key_name' flake w/ extra blobs Storage: 'test_blob_w_explicit_kms_key_name' flake w/ extra blobs Mar 4, 2019
tseaver added a commit that referenced this issue Mar 5, 2019
Also, try even harder to delete the shared bucket.

Closes #7478.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. flaky testing type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

No branches or pull requests

1 participant