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 test proxy #836

Merged
merged 34 commits into from
Aug 18, 2023
Merged

feat: add test proxy #836

merged 34 commits into from
Aug 18, 2023

Conversation

daniel-sanche
Copy link
Contributor

Adds test proxy implementation, allowing us to run language-agnostic conformance tests against the new client

Also adds support for connecting data client to an emulator

This is an update from #747

TODO:

  • add conformance tests to presubmit tests

@daniel-sanche daniel-sanche requested review from a team as code owners July 18, 2023 00:25
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. api: bigtable Issues related to the googleapis/python-bigtable API. labels Jul 18, 2023
test_proxy/README.md Outdated Show resolved Hide resolved
google/cloud/bigtable/data/_async/client.py Outdated Show resolved Hide resolved
# look for code in subexceptions
for subexc in result["subexceptions"]:
if subexc.get("code", None):
result["code"] = subexc["code"]

Choose a reason for hiding this comment

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

This will record the last exception's code. Is it intended? If so, does it correspond to the first exception occurrence (i.e., the head/root of the exception chain)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we make use of exception groups so that we can expose a set of retried errors together with the final error. The exceptions are wrapped in a bigtable.RetryException. The final exception in the group should be the most relevant one

More details here: #825

true_mutations.append(Mutation._from_dict(mut_dict))
except ValueError:
# invalid mutation type. Conformance test may be sending generic empty request
true_mutations.append(SetCell("", "", "", -1))

Choose a reason for hiding this comment

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

Does it have real effect on the client? I wonder if no-op here can also work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's been a while since I looked at this, but I think this is the one spot where I couldn't get a test to pass without modifications to the test code

I think the library will raise an exception if I try to create an empty SetCell mutation, but I believe the tests expect it. I was going to suggest we change the example mutation in the conformance tests to one with valid data

Choose a reason for hiding this comment

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

I see. You are right.. But somehow they other clients seems to be fine with the empty set. You can keep the line as is. I will make the test change later and let you know when it's done.

project_id=None,
instance_id=None,
app_profile_id=None,
per_operation_timeout=None,

Choose a reason for hiding this comment

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

what's the expected unit/format? The implementation seems to imply that it's integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the timeouts? They are float or None, but python accepts ints as floats

Choose a reason for hiding this comment

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

Does it mean seconds or milliseconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's in seconds. It's better documented here:

- operation_timeout: the time budget for the entire operation, in seconds.

Does that match the data sent from the tests?

Choose a reason for hiding this comment

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

How much do you want to support legacy client? I only see 3 APIs are implemented, what's the future plan (including deprecation)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will support them side-by-side for the medium term, with plans to eventually deprecate the old client. For now, my attention has been focused on the new data client. But it would be good to get test parity at some point

test_proxy/grpc_handler.py Outdated Show resolved Hide resolved
test_proxy/grpc_handler.py Outdated Show resolved Hide resolved
test_proxy/test_proxy.py Outdated Show resolved Hide resolved
session.run("go", "test", "-v", f"-proxy_addr=:{PROXY_SERVER_PORT}")

def default(session):
"""Run the performance test suite."""

Choose a reason for hiding this comment

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

The implementation is to run the proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may have been a copy/paste error. Fixed

),
)
proxy.start()
client_handler_process(request_q, response_queue_pool, use_legacy_client)

Choose a reason for hiding this comment

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

How is it terminated? For java client testing, we use this: https://github.com/googleapis/java-bigtable/blob/main/.kokoro/conformance.sh#L59

Copy link
Contributor Author

@daniel-sanche daniel-sanche Aug 16, 2023

Choose a reason for hiding this comment

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

Good point. It currently isn't automatically terminated, but I will need to add that for running automated tests.

I may just do this as part of the kokoro script when I add this to kokoro. Is it alright if we make that a separate PR?

Choose a reason for hiding this comment

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

sg.

project_id=None,
instance_id=None,
app_profile_id=None,
per_operation_timeout=None,

Choose a reason for hiding this comment

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

Does it mean seconds or milliseconds?

true_mutations.append(Mutation._from_dict(mut_dict))
except ValueError:
# invalid mutation type. Conformance test may be sending generic empty request
true_mutations.append(SetCell("", "", "", -1))

Choose a reason for hiding this comment

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

I see. You are right.. But somehow they other clients seems to be fine with the empty set. You can keep the line as is. I will make the test change later and let you know when it's done.

),
)
proxy.start()
client_handler_process(request_q, response_queue_pool, use_legacy_client)

Choose a reason for hiding this comment

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

sg.

@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 17, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 17, 2023
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 17, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 17, 2023
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2023
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2023
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2023
@daniel-sanche daniel-sanche merged commit 8708a25 into googleapis:v3 Aug 18, 2023
4 checks passed
daniel-sanche added a commit that referenced this pull request Feb 5, 2024
* feat: add new v3.0.0 API skeleton (#745)

* feat: improve rows filters (#751)

* feat: read rows query model class (#752)

* feat: implement row and cell model classes (#753)

* feat: add pooled grpc transport (#748)

* feat: implement read_rows (#762)

* feat: implement mutate rows (#769)

* feat: literal value filter (#767)

* feat: row_exists and read_row (#778)

* feat: read_modify_write and check_and_mutate_row (#780)

* feat: sharded read rows (#766)

* feat: ping and warm with metadata (#810)

* feat: mutate rows batching (#770)

* chore: restructure module paths (#816)

* feat: improve timeout structure (#819)

* fix: api errors apply to all bulk mutations

* chore: reduce public api surface (#820)

* feat: improve error group tracebacks on < py11 (#825)

* feat: optimize read_rows (#852)

* chore: add user agent suffix (#842)

* feat: optimize retries (#854)

* feat: add test proxy (#836)

* chore(tests): add conformance tests to CI for v3 (#870)

* chore(tests): turn off fast fail for conformance tets (#882)

* feat: add TABLE_DEFAULTS enum for table method arguments (#880)

* fix: pass None for retry in gapic calls (#881)

* feat: replace internal dictionaries with protos in gapic calls (#875)

* chore: optimize gapic calls (#863)

* feat: expose retryable error codes to users (#879)

* chore: update api_core submodule (#897)

* chore: merge main into experimental_v3 (#900)

* chore: pin conformance tests to v0.0.2 (#903)

* fix: bulk mutation eventual success (#909)

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/python-bigtable API. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants