Skip to content

Commit

Permalink
Skipped tests that are not revelent without .parms.db
Browse files Browse the repository at this point in the history
  • Loading branch information
herve-er committed May 6, 2024
1 parent effc766 commit da36fef
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/libcommonserver/log/testlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,22 @@ void TestLog::testCopyLogsTo(void) {

void TestLog::testCopyParmsDbTo(void) {
{
if (!_parmsDbFileExist()) {
std::cout << std::endl << "No .parms.db file, this test will not be relevant (skipped)." << std::endl;
LOG_WARN(_logger, "No .parms.db file, this test will not be relevant (skipped).");
return;
}

TemporaryDirectory tempDir;
const SyncPath parmsDbName = ".parms.db";
const SyncPath parmsDbPath = CommonUtility::getAppSupportDir() / parmsDbName;

uint64_t parmsDbSize = 0;
IoError err = IoErrorSuccess;
IoHelper::getFileSize(parmsDbPath, parmsDbSize, err);



CPPUNIT_ASSERT_EQUAL(IoErrorSuccess, err);
CPPUNIT_ASSERT(parmsDbSize >= 0);

Expand Down Expand Up @@ -255,6 +264,12 @@ void TestLog::testGenerateUserDescriptionFile(void) {
}

void TestLog::testGenerateLogsSupportArchive(void) {
if (!_parmsDbFileExist()) {
std::cout << std::endl << "No .parms.db file, this test will not be relevant (skipped)." << std::endl;
LOG_WARN(_logger, "No .parms.db file, this test will not be relevant (skipped).");
return;
}

{
TemporaryDirectory tempDir;
const SyncPath archiveFile = tempDir.path / "logs_support.tar.gz";
Expand All @@ -272,4 +287,18 @@ void TestLog::testGenerateLogsSupportArchive(void) {
}
}

bool TestLog::_parmsDbFileExist() {
const SyncPath parmsDbName = ".parms.db";
const SyncPath parmsDbPath = CommonUtility::getAppSupportDir() / parmsDbName;

IoError err = IoErrorSuccess;
bool exists = false;

if (!IoHelper::checkIfPathExists(parmsDbPath, exists, err)) {
return false;
}

return exists;
}

} // namespace KDC
3 changes: 3 additions & 0 deletions test/libcommonserver/log/testlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class TestLog : public CppUnit::TestFixture {
void testCompressLogs(void);
void testGenerateUserDescriptionFile(void);
void testGenerateLogsSupportArchive(void);

private:
bool _parmsDbFileExist();
};

} // namespace KDC

0 comments on commit da36fef

Please sign in to comment.