-
Notifications
You must be signed in to change notification settings - Fork 12
Adjust and enable some ControlConnection
integration tests
#255
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: As we can see, rust-driver does not provide the node address
either in the log message or in the error type.
This is something we should consider adding to rust-driver.
Please open an issue about it
- TopologyChange <- some error during
ccm add
command (need to investigate)
In a follow up or before merging this?
Ok.
I'll open separate issue regarding this. I'm not sure how much effort this would require - is it just a fix on cpp-rust-driver side? Or maybe there is some bug in ccm. Who knows... |
At the time of writing this, I confused the address translation with DNS address resolution. In addition, the `CASS_ERROR_LIB_HOST_RESOLUTION` in cpp-driver is only returned from `cass_cluster_set_local_address()` when unparsable ip address is provided.
Motivation (based on cpp-driver): 1. UNABLE_TO_CONNECT should only be returned when user tries to call `cass_session_connect` on a session that is already connecting, connected or closing. We already handle this case in `session.rs`. ``` let mut session_guard = session_opt.write().await; if session_guard.is_some() { return Err(( CassError::CASS_ERROR_LIB_UNABLE_TO_CONNECT, "Already connecting, closing, or connected".msg(), )); } ``` 2. NO_HOSTS_AVAILABLE is returned in all places where driver cannot reach one of the nodes. This includes: - pool is broken - connection is broken - connection is closed - connection is refused - empty LB plan - user provided empty list of contact points ... etc. Thanks to this change, we will also be able to enable new integration tests that expect `NO_HOSTS_AVAILABLE` error. As a side note: as you can see, the NO_HOST_AVAILABLE is mapped from a lot of Rust error types/variants. I believe we should increase the granularity of CassError enum and add more error variants. This way we will be able to define more direct mapping between Rust and cpp-rust-driver errors.
96463e6
to
b39fa51
Compare
Rebased on |
logger_.add_critera("Could not fetch metadata, error: " | ||
"Control connection pool error: The pool is broken; " | ||
"Last connection failed with: Invalid argument (os error 22)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto: portability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, do we target Windows? If so, then we should run unit & integration tests in the CI on Windows, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we want to support it eventually: #130
b39fa51
to
92e2f7c
Compare
v1.1: Addressed @wprzytula comments. |
I tried to map the underlying errors as precisely as possible (as of now). The most important one is the `MetadataError::ConnectionPoolError` which should be mapped to `LIB_NO_HOSTS_AVAILABLE`. This is required by the test.
We decided that `cass_cluster_set_local_address()` should return LIB_BAD_PARAMS in case user provides unparsable ip address.
Note: As we can see, rust-driver does not provide the node address either in the log message or in the error type. This is something we should consider adding to rust-driver.
Tests enabled: - ConnectUsingInvalidIpAddress - ConnectUsingInvalidPort - ConnectUsingUnresolvableLocalIpAddress - ConnectUsingUnbindableLocalIpAddress - ConnectUsingValidLocalIpAddressButInvalidRemote Tests that we keep disabled: - TopologyChange <- some error during `ccm add` command (need to investigate) - FullOutage <- requires cass_cluster_set_constant_reconnect - TerminatedUsingMultipleIoThreadsWithError <- requires cass_cluster_set_num_threads_io
92e2f7c
to
5baa5d3
Compare
Ref: #132
Depends on: #254. Start review from
cass_error: remove misleading comment
.To enable the tests I firstly needed to do some adjustments:
UNABLE_TO_CONNECT
error in places whereLIB_NO_HOSTS_AVAILABLE
should be returned. This is adjusted.cass_cluster_set_local_address
to returnLIB_HOST_RESOLUTION
when unparsable ip address is provided. We decided that it should returnLIB_BAD_PARAMS
in such case - I adjusted the integration test case to this.Tests
Tests enabled:
Tests that we keep disabled:
ccm add
command (need to investigate)Pre-review checklist
[ ] I have implemented Rust unit tests for the features/changes introduced..github/workflows/build.yml
ingtest_filter
..github/workflows/cassandra.yml
ingtest_filter
.