]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[426-cassandra-unit-tests-ends-with-success-even-though-they-fail] Made DB script... 426-cassandra-unit-tests-ends-with-success-even-though-they-fail
authorFrancis Dupont <fdupont@isc.org>
Tue, 5 Feb 2019 22:26:29 +0000 (23:26 +0100)
committerTomek Mrugalski <tomek@isc.org>
Thu, 7 Feb 2019 14:23:55 +0000 (09:23 -0500)
src/lib/cql/testutils/cql_schema.cc
src/lib/cql/testutils/cql_schema.h
src/lib/mysql/testutils/mysql_schema.cc
src/lib/mysql/testutils/mysql_schema.h
src/lib/pgsql/testutils/pgsql_schema.cc
src/lib/pgsql/testutils/pgsql_schema.h

index 26586b0b15f3b552b7ad71a67fcc4c89c96ed422..93a6c8b7d8f6d3aa67b33ad2bfd813487068f001 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-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
@@ -10,6 +10,7 @@
 
 #include <cql/cql_connection.h>
 #include <cql/testutils/cql_schema.h>
+#include <exceptions/exceptions.h>
 
 #include <stdlib.h>
 
@@ -79,6 +80,7 @@ runCqlScript(const std::string& path,
     int32_t retval = ::system(cmd.str().c_str());
     if (retval) {
         std::cerr << "runCqlSchema failed:" << cmd.str() << std::endl;
+        isc_throw(Unexpected, "runCqlSchema failed:" << cmd.str());
     }
 }
 
index 55f93e0adac58a193b1b4752d9e615afb10ce592..6127afd4bd7a1058cdce0e3b4db5909c697d6899 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-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
@@ -57,11 +57,12 @@ void createCqlSchema(bool force_wipe, bool show_err = false);
 /// Submits the given CQL script to CQL via cqlsh 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 runCqlScript(const std::string& path, const std::string& script_name,
                     bool show_err);
 
index 42bcf0406cfbb4cf56829ba177a1514b19687950..93ed9418c2df5600b16b8db8ef94a5fd66c61d76 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-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
@@ -9,6 +9,7 @@
 #include <mysql.h>
 #include <mysql/testutils/mysql_schema.h>
 #include <mysql/mysql_connection.h>
+#include <exceptions/exceptions.h>
 
 #include <fstream>
 #include <iostream>
@@ -54,6 +55,7 @@ void runMySQLScript(const std::string& path, const std::string& script_name,
     int retval = ::system(cmd.str().c_str());
     if (retval) {
         std::cerr << "runMySQLSchema failed:" << cmd.str() << std::endl;
+        isc_throw(Unexpected, "runMySQLSchema failed:" << cmd.str());
     }
 }
 
index ad2202d5a23f7d8bc0a20d82bddbf0191c85d0ba..9457a3341cb5ebfac8ed251f618e6abaed89b99b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-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 createMySQLSchema(bool show_err = false);
 /// Submits the given SQL script to MySQL via mysql 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 runMySQLScript(const std::string& path, const std::string& script_name,
                     bool show_err);
 
index 1d4ab1b8ac82db3322923588098a907343a842d2..1ee6baf1cab42b8ac774376512d5f001e806b600 100644 (file)
@@ -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());
     }
 }
 
index 8f07ceb6cb9b02c549ad75820ce4fbbeb8e74215..e17572a464d996341b5900003dcce2566f30c171 100644 (file)
@@ -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);