diff options
author | Francis Dupont <fdupont@isc.org> | 2019-02-05 23:26:29 +0100 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2019-02-07 15:23:55 +0100 |
commit | 1bbb2f896e5b7bf1dada6ac3534598e170ac23cc (patch) | |
tree | 48233b322685f2d916728e25bc9c91d45b829cb2 /src/lib/pgsql | |
parent | [master] Some trivial doxygen fixes (diff) | |
download | kea-1bbb2f896e5b7bf1dada6ac3534598e170ac23cc.tar.xz kea-1bbb2f896e5b7bf1dada6ac3534598e170ac23cc.zip |
[426-cassandra-unit-tests-ends-with-success-even-though-they-fail] Made DB script failure to throw
Diffstat (limited to 'src/lib/pgsql')
-rw-r--r-- | src/lib/pgsql/testutils/pgsql_schema.cc | 4 | ||||
-rw-r--r-- | src/lib/pgsql/testutils/pgsql_schema.h | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/pgsql/testutils/pgsql_schema.cc b/src/lib/pgsql/testutils/pgsql_schema.cc index 1d4ab1b8ac..1ee6baf1ca 100644 --- a/src/lib/pgsql/testutils/pgsql_schema.cc +++ b/src/lib/pgsql/testutils/pgsql_schema.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2019 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 @@ -7,6 +7,7 @@ #include <config.h> #include <string> #include <pgsql/testutils/pgsql_schema.h> +#include <exceptions/exceptions.h> #include <libpq-fe.h> @@ -56,6 +57,7 @@ void runPgSQLScript(const std::string& path, const std::string& script_name, int retval = ::system(cmd.str().c_str()); if (retval) { std::cerr << "runPgSQLSchema failed:" << cmd.str() << std::endl; + isc_throw(Unexpected, "runPgSQLSchema failed:" << cmd.str()); } } diff --git a/src/lib/pgsql/testutils/pgsql_schema.h b/src/lib/pgsql/testutils/pgsql_schema.h index 8f07ceb6cb..e17572a464 100644 --- a/src/lib/pgsql/testutils/pgsql_schema.h +++ b/src/lib/pgsql/testutils/pgsql_schema.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2019 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 @@ -53,11 +53,12 @@ void createPgSQLSchema(bool show_err = false); /// Submits the given SQL script to Postgresql via psql CLI. The output of /// stderr is suppressed unless the parameter, show_err is true. The is done /// to suppress warnings that might otherwise make test output needlessly -/// noisy. A gtest assertion occurs if the script fails to execute. +/// noisy. An exception is thrown if the script fails to execute. /// /// @param path - path (if not blank) of the script to execute /// @param script_name - file name of the path to execute /// @param show_err flag which governs whether or not stderr is suppressed. +/// @throw Unexpected when the script returns an error. void runPgSQLScript(const std::string& path, const std::string& script_name, bool show_err); |