Skip to content

Commit

Permalink
Add environment test class
Browse files Browse the repository at this point in the history
  • Loading branch information
rfdavid committed Jun 9, 2023
1 parent 89cbcb4 commit e0c46fe
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions test/runner/e2e_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ using ::testing::Test;
using namespace kuzu::testing;
using namespace kuzu::common;

class EndToEndEnvironment : public testing::Environment {
public:
virtual void SetUp() {
FileUtils::createDirIfNotExists(
TestHelper::appendKuzuRootPath(TestHelper::PARQUET_TEMP_DATASET_PATH));
}
virtual void TearDown() {
FileUtils::removeDir(TestHelper::appendKuzuRootPath(TestHelper::PARQUET_TEMP_DATASET_PATH));
}
};

class EndToEndTest : public DBTest {
public:
explicit EndToEndTest(TestGroup::DatasetType datasetType, std::string dataset,
Expand All @@ -21,18 +32,13 @@ class EndToEndTest : public DBTest {
initGraph();
}
void setUpDataset() {
FileUtils::createDirIfNotExists(
TestHelper::appendKuzuRootPath(TestHelper::PARQUET_TEMP_DATASET_PATH));
if (datasetType == TestGroup::DatasetType::CSV_TO_PARQUET) {
CSVToParquetConverter::convertCSVDatasetToParquet(dataset);
} else {
dataset = TestHelper::appendKuzuRootPath("dataset/" + dataset);
}
}
void TearDown() override {
FileUtils::removeDir(TestHelper::appendKuzuRootPath(TestHelper::PARQUET_TEMP_DATASET_PATH));
FileUtils::removeDir(TestHelper::getTmpTestDir());
}
void TearDown() override { FileUtils::removeDir(TestHelper::getTmpTestDir()); }
std::string getInputDir() override { return dataset + "/"; }
void TestBody() override { runTest(testStatements); }

Expand Down Expand Up @@ -116,6 +122,7 @@ void checkCtestParams(int argc, char** argv) {
int main(int argc, char** argv) {
checkCtestParams(argc, argv);
testing::InitGoogleTest(&argc, argv);
testing::AddGlobalTestEnvironment(new EndToEndEnvironment);
if (argc > 1) {
auto path = TestHelper::appendKuzuRootPath(
FileUtils::joinPath(TestHelper::E2E_TEST_FILES_DIRECTORY, argv[1]));
Expand Down

0 comments on commit e0c46fe

Please sign in to comment.