diff --git a/test/framework/integration_framework/integration_test_framework.cpp b/test/framework/integration_framework/integration_test_framework.cpp index 6ae70729dd..04979b6323 100644 --- a/test/framework/integration_framework/integration_test_framework.cpp +++ b/test/framework/integration_framework/integration_test_framework.cpp @@ -229,6 +229,8 @@ namespace integration_framework { void IntegrationTestFramework::done() { log_->info("done"); - iroha_instance_->instance_->storage->dropStorage(); + if (iroha_instance_->instance_ and iroha_instance_->instance_->storage) { + iroha_instance_->instance_->storage->dropStorage(); + } } } // namespace integration_framework diff --git a/test/regression/regression_test.cpp b/test/regression/regression_test.cpp index 566fb6d2ce..18fe37f882 100644 --- a/test/regression/regression_test.cpp +++ b/test/regression/regression_test.cpp @@ -80,3 +80,13 @@ TEST(RegressionTest, DoubleCallOfDone) { itf.setInitialState(kAdminKeypair).done(); itf.done(); } + +/** + * @given non initialized ITF instance + * @when done method is called inside destructor + * @then no exceptions are risen + */ +TEST(RegressionTest, DestructionOfNonInitializedItf) { + integration_framework::IntegrationTestFramework itf( + 1, [](auto &itf) { itf.done(); }); +}