Skip to content

Commit

Permalink
Fix --use-existing-data mode broken by DELETE tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asuhan committed Mar 10, 2018
1 parent a28e026 commit 198fd81
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Tests/ExecuteTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3934,6 +3934,15 @@ TEST(Select, Deleted) {

namespace {

void set_deleted_column() {
auto& cat = g_session->get_catalog();
const auto td = cat.getMetadataForTable("test_inner_deleted");
CHECK(td);
const auto cd = cat.getMetadataForColumn(td->tableId, "deleted");
CHECK(cd);
cat.setDeletedColumn(td, cd);
}

int create_and_populate_tables() {
try {
const std::string drop_old_test{"DROP TABLE IF EXISTS test_inner;"};
Expand Down Expand Up @@ -3961,12 +3970,7 @@ int create_and_populate_tables() {
const auto create_test_inner_deleted =
build_create_table_statement(columns_definition, "test_inner_deleted", {"", 0}, {}, 2);
run_ddl_statement(create_test_inner_deleted);
auto& cat = g_session->get_catalog();
const auto td = cat.getMetadataForTable("test_inner_deleted");
CHECK(td);
const auto cd = cat.getMetadataForColumn(td->tableId, "deleted");
CHECK(cd);
cat.setDeletedColumn(td, cd);
set_deleted_column();
g_sqlite_comparator.query("CREATE TABLE test_inner_deleted(x int not null, y int, str text);");
} catch (...) {
LOG(ERROR) << "Failed to (re-)create table 'test_inner_deleted'";
Expand Down Expand Up @@ -4466,6 +4470,7 @@ int main(int argc, char** argv) {
const bool use_existing_data = vm.count("use-existing-data");
int err{0};
if (use_existing_data) {
set_deleted_column();
testing::GTEST_FLAG(filter) = "Select*";
} else {
err = create_and_populate_tables();
Expand Down

0 comments on commit 198fd81

Please sign in to comment.