scylladb / scylla-rust-driver

Async CQL driver for Rust, optimized for ScyllaDB!
Apache License 2.0
582 stars 104 forks source link

robustness: test that driver returns errors in invalid external conditions instead of panicking #1056

Open wprzytula opened 3 months ago

wprzytula commented 3 months ago

Problem statement

The driver's tests so far have focused on asserting that in valid conditions, a valid behaviour is exhibited (a request is completed successfully, etc.). However, there is very few tests focusing on driver's behaviour in invalid external conditions, such as malformed message received or bad user input. What is especially dangerous is panicking in such situations, instead of e.g. returning an error from a query or printing an error! log entry.

TODO

Write more tests that accept invalid inputs and assert robust driver's behaviour, no panics in particular.

Note: These tests should be rather considered integration tests, or even e2e tests, because they check error flow through multiple driver's layers.

A probable blocker is error refactor, because only after it we will be able to truly match on QueryError; at the moment QueryError::InvalidMessage is a stringified ParseError, which itself contains a lot of stringified errors. This must be changed into matchable/downcastable error kinds.

Items to be tested