Skip to content

Commit a605130

Browse files
committed
tests: Fix sporadic error in test_nospace
Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
1 parent 5bd0f08 commit a605130

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

tests/nospace_test.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ TEST_P(AkliteNoSpaceTest, OstreeAndAppUpdateNotEnoughSpaceForApps) {
485485
// App's containers are re-created before reboot
486486
auto app01 = registry.addApp(fixtures::ComposeApp::create("app-01"));
487487

488-
auto client = createLiteClient();
489-
ASSERT_TRUE(targetsMatch(client->getCurrent(), getInitialTarget()));
488+
auto client_ = createLiteClient();
489+
ASSERT_TRUE(targetsMatch(client_->getCurrent(), getInitialTarget()));
490490
ASSERT_FALSE(app_engine->isRunning(app01));
491491

492492
std::vector<AppEngine::App> apps{app01};
@@ -495,6 +495,7 @@ TEST_P(AkliteNoSpaceTest, OstreeAndAppUpdateNotEnoughSpaceForApps) {
495495
{
496496
// Not enough free space to pull an App bundle/archive since there is only 20% of free space
497497
// and 20% is reserved, so 0% is available for the update
498+
auto client = createLiteClient();
498499
SetFreeBlockNumb(20, 100);
499500
update(*client, getInitialTarget(), new_target, data::ResultCode::Numeric::kDownloadFailed,
500501
{DownloadResult::Status::DownloadFailed_NoSpace, "Insufficient storage available"});
@@ -508,6 +509,7 @@ TEST_P(AkliteNoSpaceTest, OstreeAndAppUpdateNotEnoughSpaceForApps) {
508509
// Enough free space to pull an App bundle/archive since there is 21 - 20% of free space.
509510
// But, it's not enough available free space to pull the App image because
510511
// the App image requires more than 1 block.
512+
auto client = createLiteClient();
511513
SetFreeBlockNumb(21, 100);
512514
update(*client, getInitialTarget(), new_target, data::ResultCode::Numeric::kDownloadFailed,
513515
{DownloadResult::Status::DownloadFailed_NoSpace, "Insufficient storage available"});
@@ -520,9 +522,12 @@ TEST_P(AkliteNoSpaceTest, OstreeAndAppUpdateNotEnoughSpaceForApps) {
520522
{
521523
// Enough free space to pull an App bundle/archive and the App image layers/blobs.
522524
// But, it's not enough available free space to accommodate the App in the docker store (extracted image layers).
523-
SetFreeBlockNumb(37, 100);
524-
update(*client, getInitialTarget(), new_target, data::ResultCode::Numeric::kDownloadFailed,
525-
{DownloadResult::Status::DownloadFailed_NoSpace, "Insufficient storage available"});
525+
{
526+
auto client = createLiteClient();
527+
SetFreeBlockNumb(37, 100);
528+
update(*client, getInitialTarget(), new_target, data::ResultCode::Numeric::kDownloadFailed,
529+
{DownloadResult::Status::DownloadFailed_NoSpace, "Insufficient storage available"});
530+
}
526531
const auto event_err_msg{getEventContext("EcuDownloadCompleted")};
527532
ASSERT_TRUE(std::string::npos != event_err_msg.find("store: docker")) << event_err_msg;
528533
ASSERT_TRUE(std::string::npos !=

0 commit comments

Comments
 (0)