Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove file path sensitivity from DB error handling checks in unit tests #902

Merged
merged 2 commits into from Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions unittests/Core/SQLiteBuildDBTest.cpp
Expand Up @@ -47,10 +47,7 @@ TEST(SQLiteBuildDBTest, ErrorHandling) {
bool result = true;
buildDB->getCurrentEpoch(&result, &error);
EXPECT_FALSE(result);

std::stringstream out;
out << "error: accessing build database \"" << path << "\": database is locked Possibly there are two concurrent builds running in the same filesystem location.";
EXPECT_EQ(error, out.str());
EXPECT_TRUE(error.find("database is locked") != std::string::npos);

// Clean up database connections before unlinking
sqlite3_exec(db, "END;", nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -85,9 +82,7 @@ TEST(SQLiteBuildDBTest, LockedWhileBuilding) {
// Tests that we cannot start a second build with an existing connection
result = secondBuildDB->buildStarted(&error);
EXPECT_FALSE(result);
std::stringstream out;
out << "error: accessing build database \"" << path << "\": database is locked Possibly there are two concurrent builds running in the same filesystem location.";
EXPECT_EQ(error, out.str());
EXPECT_TRUE(error.find("database is locked") != std::string::npos);

// Tests that we cannot create new connections while a build is running
std::unique_ptr<BuildDB> otherBuildDB = createSQLiteBuildDB(dbPath, 1, /* recreateUnmatchedVersion = */ true, &error);
Expand All @@ -98,7 +93,7 @@ TEST(SQLiteBuildDBTest, LockedWhileBuilding) {
bool success = true;
otherBuildDB->getCurrentEpoch(&success, &error);
EXPECT_FALSE(success);
EXPECT_EQ(error, out.str());
EXPECT_TRUE(error.find("database is locked") != std::string::npos);

// Clean up database connections before unlinking
buildDB->buildComplete();
Expand Down