From c6435c86d25654408945b09f1ad48723b38aaa67 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Mon, 29 Jul 2019 20:04:55 +0900 Subject: [PATCH] Fix recovery test's failure 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 --- src/unit_tests/recovery_test.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/unit_tests/recovery_test.cc b/src/unit_tests/recovery_test.cc index 71b652c..da59539 100644 --- a/src/unit_tests/recovery_test.cc +++ b/src/unit_tests/recovery_test.cc @@ -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 #include #include @@ -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", -- 2.34.1