Skip to content

Conversation

sergiyvamz
Copy link
Contributor

Summary

Introduce a new development plugin to simulate different exceptional cases. The plugin is aim to help with testing of rare exceptional cases like database cluster failover and network issues.

Description

A new dev plugin should be added to connection plugins parameter in order to be able to intercept JDBC calls and raise a test exception when conditions are met.

Connection connection = DriverManager.getConnection(...);
ConnectionWrapper connectionWrapper = (ConnectionWrapper) connection;
ExceptionSimulator simulator = connectionWrapper.unwrap(ExceptionSimulator.class);
simulator.raiseExceptionOnNextCall("Connection.createStatement", testExceptionToRaise);

In order to raise a test exception while opening a new connection, it's possible to use ExceptionSimulatorManager.

ExceptionSimulatorManager.raiseExceptionOnNextConnect(testExceptionToRaise);
Connection connection = DriverManager.getConnection(...); // that throws an exception

Additional Reviewers

@karenc-bq @congoamz @aaronchung-bitquill @crystall-bitquill

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergiyvamz sergiyvamz merged commit 0668249 into main Jul 10, 2023
@sergiyvamz sergiyvamz deleted the dev-plugin branch July 10, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants