Fix recovery test's failure 54/211054/3
authorIlho Kim <ilho159.kim@samsung.com>
Mon, 29 Jul 2019 11:04:55 +0000 (20:04 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 13 Aug 2019 04:20:11 +0000 (04:20 +0000)
In testcase with repeat, PkgQuery has handle that made from singleton,
so there is a need to reset the singleton

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

index 71b652c..da59539 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by an apache-2.0 license that can be
 // found in the LICENSE file.
 
+#include <common/pkgmgr_query.h>
 #include <common/utils/subprocess.h>
 #include <unit_tests/common/smoke_utils.h>
 
@@ -131,7 +132,10 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) {
 }
 
 TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
+  std::string pkgid = "smokeapp16";
+
   RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
+  ci::PkgQuery::Instance().GetResult(pkgid, params.test_user.uid, true);
 
   bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_Tpk_Update.tpk";
   bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_Tpk_Update_2.tpk";
@@ -144,7 +148,6 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
   tpk_backend.Kill();
 
   if (tpk_backend.Wait() == 9) {
-    std::string pkgid = "smokeapp16";
     std::string appid = "smokeapp16.RecoveryModeTpkUpdate";
     std::string exec = "native";
     bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
@@ -160,7 +163,10 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
 }
 
 TEST_F(SmokeTest, RecoveryMode_ForDelta) {
+  std::string pkgid = "smoketpk35";
+
   RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
+  ci::PkgQuery::Instance().GetResult(pkgid, params.test_user.uid, true);
 
   bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.tpk";
   bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta";
@@ -173,7 +179,6 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) {
   tpk_backend.Kill();
 
   if (tpk_backend.Wait() == 9) {
-    std::string pkgid = "smoketpk35";
     std::string appid = "smoketpk35.RecoveryMode_ForDelta";
     std::string exec = "smoketpk35";
     bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
@@ -218,7 +223,9 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
 }
 
 TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
+  std::string pkgid = "smoketpk38";
   RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
+  ci::PkgQuery::Instance().GetResult(pkgid, params.test_user.uid, true);
 
   bf::path path_old =
       kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate.tpk";
@@ -233,7 +240,6 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
   tpk_backend.Kill();
 
   if (tpk_backend.Wait() == 9) {
-    std::string pkgid = "smoketpk38";
     std::string appid = "smoketpk38.RecoveryMode_ForMountUpdate";
     std::string exec = "smoketpk38";
     bf::path recovery_file = FindRecoveryFile("/tpk-recovery",