Skip to content

Commit

Permalink
tmp: test
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Sul <[email protected]>
  • Loading branch information
mike-sul committed Sep 4, 2023
1 parent 9542445 commit 46d4b68
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/nospace_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ TEST_F(NoSpaceTest, OstreeUpdateNoSpaceIfStaticDelta) {
auto client = createLiteClient();
ASSERT_TRUE(targetsMatch(client->getCurrent(), getInitialTarget()));
// Delta size is 3 + 1 = 4 blocks
setGenerateStaticDelta(3);
setGenerateStaticDelta(3, true);
auto new_target = createTarget();
const auto delta_size{getDeltaSize(getInitialTarget(), new_target)};
getOsTreeRepo().removeDeltaStats();
{
// The delta-based update if there is no stat/info about the delta, so the pre-pull verification
// of the update size is not possible. Thus, the error originates in libostree; libostree does NOT
Expand Down Expand Up @@ -318,17 +320,22 @@ TEST_F(NoSpaceTest, OstreeUpdateNoSpaceIfStaticDelta) {
// but there is a moment during the delta-based pull when libostree has the delta file
// on a file system + extracted files while it commits the extracted files to the repo.
// So, it takes into account the delta file size + extracted objects during ostree objects committing,
// therefore we need 4% + 4% + <the delta file size> ~ 10% (required)+ 3% (reserved) ~ 13% (at least 14 free blocks
// is required)
// therefore we need 4% + 4% + <the delta file size> ~ 10% (required)+ 3% (reserved) ~ 13% (at least 13 free blocks
// is required, but just 12 is available)
//
SetFreeBlockNumb(13, 100);
storage::Volume::UsageInfo usage_info{.size = {100 * 4096, 100}, .available = {(12 - 3) * 4096, 12 - 3}};
std::stringstream expected_available;
usage_info.withRequired(delta_size);
LOG_ERROR << ">>>> Required: " << usage_info.required;
expected_available << usage_info.available;
SetFreeBlockNumb(12, 100);
update(*client, getInitialTarget(), new_target, data::ResultCode::Numeric::kDownloadFailed,
{DownloadResult::Status::DownloadFailed_NoSpace, "Insufficient storage available"});
ASSERT_TRUE(targetsMatch(client->getCurrent(), getInitialTarget()));
const auto event_err_msg{getEventContext("EcuDownloadCompleted")};
ASSERT_TRUE(std::string::npos != event_err_msg.find("min-free-space-percent '3%' would be exceeded, at least"))
<< event_err_msg;
ASSERT_TRUE(std::string::npos != event_err_msg.find("available: 40960B 10%")) << event_err_msg;
ASSERT_TRUE(std::string::npos != event_err_msg.find(expected_available.str())) << event_err_msg;
ASSERT_TRUE(std::string::npos !=
event_err_msg.find(OSTree::Sysroot::Config::ReservedStorageSpacePercentageOstreeParamName));
}
Expand Down

0 comments on commit 46d4b68

Please sign in to comment.