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

feat: add smoketest for enum values handling in compute #13963

Conversation

viacheslav-rostovtsev
Copy link
Member

@viacheslav-rostovtsev viacheslav-rostovtsev commented Sep 13, 2021

This test verifies that an unknown enum value in proto JSON is being parsed into a label for the default enum value (0).
In proto3 there is always a enum member with a value 0; in Compute specifically a 0-valued member is always a nonfunctional one, called UNDEFINED_<ENUM_NAME>.
For this specific example, for a enum State, it's UNDEFINED_STATE, so an unknown enum value in proto JSON is parsed into a label :UNDEFINED_STATE.

@viacheslav-rostovtsev viacheslav-rostovtsev added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Sep 13, 2021
@viacheslav-rostovtsev viacheslav-rostovtsev requested a review from a team as a code owner September 13, 2021 20:40
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 13, 2021
@quartzmo
Copy link
Member

It looks to me like this should run as a unit test, not a smoke test. Can you add handwritten unit tests for this library? I copy/pasted just the test (without setup) to test/google/cloud/compute/v1/accelerator_types_test.rb and got this result:

  1) Error:
Google::Cloud::Compute::V1::AcceleratorTypes::ClientTest#test_parse_unknown_enum_value:
Google::Protobuf::ParseError: Error occurred during parsing: Error parsing JSON @1:52: Unknown enumerator: 'THIS_VALUE_DOES_NOT_EXIST'
    /Users/quartzmo/code/google/codez/google-cloud-ruby/google-cloud-compute-v1/test/google/cloud/compute/v1/accelerator_types_test.rb:74:in `decode_json'
    /Users/quartzmo/code/google/codez/google-cloud-ruby/google-cloud-compute-v1/test/google/cloud/compute/v1/accelerator_types_test.rb:74:in `test_parse_unknown_enum_value'

@viacheslav-rostovtsev viacheslav-rostovtsev force-pushed the dev/virost/feat/add_compute_smoke_enum_test branch from 1298292 to ea46a60 Compare October 7, 2021 20:29
@viacheslav-rostovtsev viacheslav-rostovtsev removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 7, 2021
@viacheslav-rostovtsev
Copy link
Member Author

viacheslav-rostovtsev commented Oct 7, 2021

It looks to me like this should run as a unit test, not a smoke test. Can you add handwritten unit tests for this library?

Rewritten as a unit test.

Copy link
Member

@dazuma dazuma left a comment

Choose a reason for hiding this comment

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

test(compute-v1): add a test for enum values handling

@dazuma dazuma merged commit 1fcb695 into googleapis:master Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants