Commit 1bbb2f89 authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski

[426-cassandra-unit-tests-ends-with-success-even-though-they-fail] Made DB script failure to throw

parent 849e7007
// 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());
}
}
......
// 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);
......
// 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());
}
}
......
// 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);
......
// 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());
}
}
......
// 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment