Skip to content

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

@wprzytula

Description

@wprzytula

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

  • Query execution - test errors on the whole route from passing query string and values by the user up until deserializing response and providing it to the user.
  • TODO: add more as ideas pop up.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions