Validate unpacked_dir not exists when recovery done 24/235424/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 4 Jun 2020 10:37:55 +0000 (19:37 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 4 Jun 2020 10:37:55 +0000 (19:37 +0900)
Change-Id: I6ff9f1e84b57f431df67f9e9dd5e6abed78b0f4c
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/unit_tests/smoke_test.cc

index a00ffd6811610fc3b6435a49938185e05cd3bf2d..9fac9359597b9d4951d16ad159717dcdc4f9ae7a 100644 (file)
@@ -263,8 +263,11 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
   ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
 }
 
 TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
@@ -287,10 +290,13 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
 
   ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
   ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true);
   std::string version_recovered = pkg_query2.Version();
   ASSERT_TRUE(version_old == version_recovered);
@@ -579,6 +585,8 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file));
   ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
 
@@ -588,6 +596,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) {
                                           params.test_user.uid);
   ASSERT_TRUE(bf::exists(root_path / pkgid / "res/DELETED"));
   ASSERT_FALSE(bf::exists(root_path / pkgid / "res/ADDED"));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
 }
 
 TEST_F(RollbackSmokeTest, UpdateMode) {
@@ -621,8 +630,11 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file));
   ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
 }
 
 TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
@@ -651,6 +663,8 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file));
   ScopedTzipInterface interface(pkgid, params.test_user.uid);
 
@@ -658,6 +672,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params));
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "shared/res/VERSION", "1",
           params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
   ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true);
   std::string version_recovered = pkg_query2.Version();
   ASSERT_TRUE(version_old == version_recovered);
@@ -838,10 +853,13 @@ TEST_F(SmokeTest, RecoveryMode_SharedDataUpdate) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
 
   ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
   ASSERT_TRUE(CheckSharedDataExistance(pkgid, params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
 }
 
 TEST_F(SmokeTest, RecoveryMode_NonSharedDataUpdate) {
@@ -862,10 +880,13 @@ TEST_F(SmokeTest, RecoveryMode_NonSharedDataUpdate) {
   bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
       params.test_user.uid);
   ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
   ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
 
   ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
   ASSERT_TRUE(CheckSharedDataNonExistance(pkgid, params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
 }
 
 }  // namespace smoke_test