Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
aktualizr: test sending raw report
Browse files Browse the repository at this point in the history
Signed-off-by: Kostiantyn Bushko <[email protected]>
  • Loading branch information
kbushgit authored and Kostiantyn Bushko committed Jun 18, 2020
1 parent ca1e47f commit f14aec9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/libaktualizr/primary/aktualizr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2028,6 +2028,29 @@ TEST(Aktualizr, ManifestCustom) {
}
}

TEST(Aktualizr, CustomInstallationRawReport) {
TemporaryDirectory temp_dir;
auto http = std::make_shared<HttpFake>(temp_dir.Path(), "hasupdate", fake_meta_dir);

Config conf = UptaneTestCommon::makeTestConfig(temp_dir, http->tls_server);
auto storage = INvStorage::newStorage(conf.storage);
UptaneTestCommon::TestAktualizr aktualizr(conf, storage, http);

aktualizr.Initialize();
result::UpdateCheck update_result = aktualizr.CheckUpdates().get();
result::Download download_result = aktualizr.Download(update_result.updates).get();
result::Install install_result = aktualizr.Install(download_result.updates).get();

auto custom_raw_report = "Installation's custom raw report!";
EXPECT_TRUE(aktualizr.SetInstallationRawReport(custom_raw_report));
aktualizr.SendManifest().get();
EXPECT_EQ(http->last_manifest["signed"]["installation_report"]["report"]["raw_report"], custom_raw_report);

// After sending manifest, an installation report will be removed from the DB,
// so Aktualzr::SetInstallationRawReport must return a negative value.
EXPECT_FALSE(aktualizr.SetInstallationRawReport(custom_raw_report));
}

class CountUpdateCheckEvents {
public:
CountUpdateCheckEvents() = default;
Expand Down

0 comments on commit f14aec9

Please sign in to comment.