Fixed a flaky case in Catalog test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/696a783e Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/696a783e Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/696a783e Branch: refs/heads/trace Commit: 696a783e5d8adb3ca62ca9044a8d7ccd89f67b3a Parents: e496cb5 Author: Zuyu Zhang <[email protected]> Authored: Sun Oct 8 14:20:41 2017 -0500 Committer: Zuyu Zhang <[email protected]> Committed: Mon Oct 9 11:34:50 2017 -0500 ---------------------------------------------------------------------- catalog/tests/Catalog_unittest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/696a783e/catalog/tests/Catalog_unittest.cpp ---------------------------------------------------------------------- diff --git a/catalog/tests/Catalog_unittest.cpp b/catalog/tests/Catalog_unittest.cpp index f761026..7b121fa 100644 --- a/catalog/tests/Catalog_unittest.cpp +++ b/catalog/tests/Catalog_unittest.cpp @@ -552,13 +552,15 @@ TEST_F(CatalogTest, CatalogIndexTest) { IndexSubBlockDescription index_description; index_description.set_sub_block_type(IndexSubBlockDescription::CSB_TREE); index_description.add_indexed_attribute_ids(rel->getAttributeByName("attr_idx1")->getID()); + IndexSubBlockDescription index_description_copy; + index_description_copy.MergeFrom(index_description); EXPECT_TRUE(rel->addIndex("idx1", std::move(index_description))); EXPECT_TRUE(rel->hasIndexWithName("idx1")); // Adding an index with duplicate name should return false. - EXPECT_FALSE(rel->addIndex("idx1", std::move(index_description))); + EXPECT_FALSE(rel->addIndex("idx1", IndexSubBlockDescription())); // Adding an index of same type with different name on the same attribute should return false. - EXPECT_FALSE(rel->addIndex("idx2", std::move(index_description))); + EXPECT_FALSE(rel->addIndex("idx2", std::move(index_description_copy))); index_description.Clear(); index_description.set_sub_block_type(IndexSubBlockDescription::CSB_TREE);
