Skip to content

Review mocking for data_tools for test_get_video_frame_from_task unit test #1560

@anthony-chaudhary

Description

@anthony-chaudhary

It appears to simply be that that test bucket was deleted and that therefore the test fails:
google.api_core.exceptions.NotFound: 404 GET https://storage.googleapis.com/storage/v1/b/***?projection=noAcl&prettyPrint=false: The specified bucket does not exist.1

However, instead of spot treating this, we should be mocking that part of it for the scope of getting the video frame. Not testing GCP bucket here.Then if needed separately testing the GCP bucket / remote URL bucket directly. Since the test is just testing the request/response, it's not like its' getting the raw bytes of an image and testing that side of it.

[2023-10-17 20:06:11,264] ERROR data_tools_core_gcp.py Line 42: Error intializing GCP Client
ERROR [shared] Error intializing GCP Client
Traceback (most recent call last):
  File "/__w/diffgram/diffgram/shared/data_tools_core_gcp.py", line [34](https://github.com/diffgram/diffgram/actions/runs/6552236449/job/17795115549#step:20:35), in __init__
    self.bucket = self.gcs.get_bucket(settings.CLOUD_STORAGE_BUCKET)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/cloud/storage/client.py", line [39](https://github.com/diffgram/diffgram/actions/runs/6552236449/job/17795115549#step:20:40)4, in get_bucket
    bucket.reload(
  File "/usr/local/lib/python3.11/site-packages/google/cloud/storage/bucket.py", line 996, in reload
    super(Bucket, self).reload(
  File "/usr/local/lib/python3.11/site-packages/google/cloud/storage/_helpers.py", line 218, in reload
    api_response = client._connection.api_request(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/cloud/storage/_http.py", line 63, in api_request
    return call()
           ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/api_core/retry.py", line 349, in retry_wrapped_func
    return retry_target(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/api_core/retry.py", line 191, in retry_target
    return target()
           ^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/cloud/_http.py", line [48](https://github.com/diffgram/diffgram/actions/runs/6552236449/job/17795115549#step:20:49)4, in api_request
    raise exceptions.from_http_response(response)

https://github.com/diffgram/diffgram/actions/runs/6552236449/job/17795115549

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions