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

cleanup(storage): remove unused code in emulator #7048

Merged

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jul 23, 2021

Since we are no longer sending gRPC requests for Bucket metadata
operations, we do not need to emulate them either. This is needed
because the v2/ protos do not expose these RPCs (yet).

Part of the work for #6982


This change is Reviewable

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 23, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 23, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 4ae8f5300cde4b696c29e1f14f5aa1da959db707

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Jul 23, 2021

Codecov Report

Merging #7048 (b972167) into main (ba41d5a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7048   +/-   ##
=======================================
  Coverage   94.48%   94.48%           
=======================================
  Files        1304     1304           
  Lines      112319   112319           
=======================================
  Hits       106126   106126           
  Misses       6193     6193           
Impacted Files Coverage Δ
google/cloud/pubsub/subscriber_connection_test.cc 97.20% <0.00%> (-0.70%) ⬇️
google/cloud/pubsub/samples/samples.cc 91.75% <0.00%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba41d5a...b972167. Read the comment docs.

@coryan coryan marked this pull request as ready for review July 23, 2021 16:03
@coryan coryan requested a review from a team as a code owner July 23, 2021 16:03
Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @coryan)


google/cloud/storage/emulator/gcs/bucket.py, line 466 at r1 (raw file):

            "kind": "storage#notification",
            "id": "notification-%d" % random.getrandbits(16),
            "payload_format": "JSON_API_V1",

I'm sure you know, but I do not know why "JSON_API_V1" is the default value


google/cloud/storage/emulator/tests/test_bucket.py, line 302 at r1 (raw file):

        bucket, _ = gcs.bucket.Bucket.init(request, None)

        for topic in ["test-topic-1", "test-topic-2"]:

why do we need the loop?


google/cloud/storage/emulator/tests/test_bucket.py, line 311 at r1 (raw file):

            get = bucket.get_notification(notification["id"], None)
            self.assertEqual(notification, get)

get is a strange variable name

Since we are no longer sending gRPC requests for Bucket metadata
operations, we do not need to emulate them either. This is needed
because the v2/ protos do not expose these RPCs (yet).
@coryan coryan force-pushed the cleanup-storage-remove-unused-code-from-emulator branch from 4ae8f53 to f8a45ee Compare July 23, 2021 17:41
Copy link
Contributor Author

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 5 files reviewed, all discussions resolved (waiting on @dbolduc)


google/cloud/storage/emulator/gcs/bucket.py, line 466 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

I'm sure you know, but I do not know why `"JSON_API_V1" is the default value

It should not have been, thanks for pointing it out.


google/cloud/storage/emulator/tests/test_bucket.py, line 302 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

why do we need the loop?

Because I was going to test listing, and then I forgot. Fixed.


google/cloud/storage/emulator/tests/test_bucket.py, line 311 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

get is a strange variable name

Fixed.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: f8a45ee50bdc2850092099530549f950eded2d2a

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

Copy link
Contributor Author

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Reviewable status: 2 of 5 files reviewed, all discussions resolved (waiting on @dbolduc)

Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 5 files reviewed, 1 unresolved discussion (waiting on @coryan and @dbolduc)


google/cloud/storage/emulator/tests/test_bucket.py, line 319 at r2 (raw file):

        for id in [n["id"] for n in expected]:
            bucket.delete_notification(id, None)

I think this would be easier on the eyes:

for n in expected:
  bucket.delete_notification(n["id"], None)

Copy link
Contributor Author

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 5 files reviewed, 1 unresolved discussion (waiting on @dbolduc)


google/cloud/storage/emulator/tests/test_bucket.py, line 319 at r2 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…
        for id in [n["id"] for n in expected]:
            bucket.delete_notification(id, None)

I think this would be easier on the eyes:

for n in expected:
  bucket.delete_notifications(n["id"], None)

Done.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: b9721676d7fb8fec83a1f3010ddb0a96db79356f

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan merged commit 727bc4f into googleapis:main Jul 23, 2021
@coryan coryan deleted the cleanup-storage-remove-unused-code-from-emulator branch July 23, 2021 20:25
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. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants