Skip to content

Commit

Permalink
tests: update fake manifest test checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vgmoose committed Nov 25, 2023
1 parent f8a734f commit c239817
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tests/9_FakeManifestTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ class FakeManifestTest : public Test {
{
install(get, "missingmanifest");

if (!exists("sdroot/image.png")) {
error << "The downloaded file in package 'missingmanifest' on server 'c' did not successfully extract" << endl;
return false;
}

std::string sum = calculateMD5("sdroot/image.png").c_str();
const char * rightSum = "26a7965e5aa6acced42de92eeee76d7a";
if (rightSum != sum) {
error << "The downloaded file in package 'missingmanifest' on server 'c' has incorrect md5 sum, expected: " << rightSum << ", received: " << sum.c_str() << endl;
return false;
}

// make sure the missingmanifest has "installed" state
auto missingmanifest = get->lookup("missingmanifest");
if (!missingmanifest || missingmanifest->getStatus() != INSTALLED) {
error << "The package 'missingmanifest' on server 'c' was not installed" << endl;
return false;
}

// install one more time, and make sure we're still all good
install(get, "missingmanifest");

Expand All @@ -25,6 +37,9 @@ class FakeManifestTest : public Test {
return false;
}

// TODO: test zip extractions with an extra folder or no folder directory
// TODO: test upgrade of fake manifest packages

return true;
}
};
Binary file modified tests/server/c/zips/missingmanifest.zip
Binary file not shown.
4 changes: 3 additions & 1 deletion tests/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ std::string calculateMD5(const char* path)
char* file_buffer;

file_descript = open(path, O_RDONLY);
if(file_descript < 0) exit(-1);
if(file_descript < 0) {
return "";
}

file_size = get_size_by_fd(file_descript);

Expand Down

0 comments on commit c239817

Please sign in to comment.