Modify recovery test to handle cleanup type 34/217234/1
authorIlho Kim <ilho159.kim@samsung.com>
Fri, 8 Nov 2019 00:45:19 +0000 (09:45 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Fri, 8 Nov 2019 01:13:26 +0000 (10:13 +0900)
When recovery file set cleanup, recovery package is updated
So in this case, it is necessary to compare updated content

-Reference
    [app-installers]https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/216457/

Change-Id: Id005fcb3ec495822c90e00f7fd4a396b31f9ff56
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/unit_tests/recovery_test.cc

index 4fd4383..3df4a94 100644 (file)
@@ -154,10 +154,12 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
         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\n", params));
+    ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION",
+        recovery_info->cleanup() ? "2\n" : "1\n", params));
   } else {
     std::cout << "update finished before process killed" << std::endl;
   }
@@ -188,12 +190,16 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) {
                                             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));
-    ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1\n",
-        params));
-    ASSERT_TRUE(bf::exists(root_path / pkgid / "res/DELETED"));
-    ASSERT_FALSE(bf::exists(root_path / pkgid / "res/ADDED"));
+    ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION",
+        recovery_info->cleanup() ? "2\n" : "1\n", params));
+    bool deleted_exist = bf::exists(root_path / pkgid / "res/DELETED");
+    bool added_exist = bf::exists(root_path / pkgid / "res/ADDED");
+    ASSERT_NE(deleted_exist, added_exist);
+    ASSERT_TRUE(recovery_info->cleanup() ? added_exist : deleted_exist);
   } else {
     std::cout << "delta finished before process killed" << std::endl;
   }