/// @brief Destroys the HDS and the schema.
void destroyTest() {
- try {
- hdsptr_->rollback();
- } catch (...) {
- // Rollback may fail if backend is in read only mode. That's ok.
+ if (hdsptr_) {
+ try {
+ hdsptr_->rollback();
+ } catch (...) {
+ // Rollback may fail if backend is in read only mode. That's ok.
+ }
}
HostMgr::delAllBackends();
hdsptr_.reset();
void
MySQLHostMgrTest::TearDown() {
- try {
- HostMgr::instance().getHostDataSource()->rollback();
- } catch(...) {
- // we don't care if we aren't in a transaction.
+ if (HostMgr::instance().getHostDataSource()) {
+ try {
+ HostMgr::instance().getHostDataSource()->rollback();
+ } catch(...) {
+ // we don't care if we aren't in a transaction.
+ }
}
HostMgr::delBackend("mysql");
-// Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2026 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// @brief Destroys the HDS and the schema.
void destroyTest() {
- try {
- hdsptr_->rollback();
- } catch (...) {
- // Rollback may fail if backend is in read only mode. That's ok.
+ if (hdsptr_) {
+ try {
+ hdsptr_->rollback();
+ } catch (...) {
+ // Rollback may fail if backend is in read only mode. That's ok.
+ }
}
HostMgr::delAllBackends();
hdsptr_.reset();
void
PgSQLHostMgrTest::TearDown() {
- try {
- HostMgr::instance().getHostDataSource()->rollback();
- } catch(...) {
- // we don't care if we aren't in a transaction.
+ if (HostMgr::instance().getHostDataSource()) {
+ try {
+ HostMgr::instance().getHostDataSource()->rollback();
+ } catch(...) {
+ // we don't care if we aren't in a transaction.
+ }
}
HostMgr::delBackend("postgresql");