Change res-copy behavior when handling uninstall request 38/263638/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 7 Sep 2021 07:54:04 +0000 (16:54 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 7 Sep 2021 07:54:04 +0000 (16:54 +0900)
Change it to proceed uninstall requests even if there are no
package information on database.

Change-Id: I494b7879d6dd66079c81cd6c387f4b952d86dbf4
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/res-copy/src/condition_validator.cc
tests/unit_tests/res-copy/src/test_condition_validator.cc

index 9c1d1b93ac2083ef66ed12f9183b534bbfac99dd..b089129a346fc90c91f0d9a273d818e265e3f01d 100644 (file)
@@ -124,7 +124,8 @@ ConditionValidator::ConditionValidator(std::string pkgid, uid_t uid) :
 
 ErrorType ConditionValidator::ValidateCondition(ReqType req_type,
       std::list<ResPathInfo> path_list) {
-  if (!IsPackageExists(pkgid_, uid_))
+  if (!IsPackageExists(pkgid_, uid_) &&
+      req_type != ReqType::REQ_TYPE_UNINSTALL)
     return ErrorType::ERROR_PKG_NOT_FOUND;
 
   if (req_type == ReqType::REQ_TYPE_NEW)
index 94e70726c7b3ee90ca80d313d22b3801e10f31de..c2fe687c061926874c0707c70a51abc32e6cc0e5 100644 (file)
@@ -136,6 +136,6 @@ TEST_F(ConditionValidatorTest, DeletePkgNotExist) {
   res_handler::ErrorType ret = validator.ValidateCondition(
       checker.GetRequestType(), checker.GetPathList());
 
-  EXPECT_EQ(ret, res_handler::ErrorType::ERROR_PKG_NOT_FOUND);
+  EXPECT_EQ(ret, res_handler::ErrorType::ERROR_NONE);
 }