Smoke tests for recovery of tpk packages 42/46142/3
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 14 Aug 2015 10:32:46 +0000 (12:32 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Wed, 19 Aug 2015 08:27:05 +0000 (01:27 -0700)
Change-Id: I0d8d0d5840e46ed77f33c4d7e116d91878d7aa62

src/unit_tests/smoke_test.cc
src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Installation.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update_2.tpk [new file with mode: 0644]

index 071123e..e443176 100644 (file)
@@ -495,6 +495,37 @@ TEST_F(SmokeTest, DeinstallationMode_Tpk) {
   CheckPackageNonExistance(pkgid, appid);
 }
 
+TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) {
+  bf::path path = "/usr/share/app-installers-ut/test_samples/smoke/RecoveryMode_Tpk_Installation.tpk";  // NOLINT
+  ASSERT_DEATH(Install(path, PackageType::TPK, RequestResult::CRASH), ".*");
+
+  std::string pkgid = "smokeapp15";
+  std::string appid = "smokeapp15.RecoveryModeTpkInstallation";
+  bf::path recovery_file = FindRecoveryFile();
+  ASSERT_FALSE(recovery_file.empty());
+  ASSERT_EQ(Recover(recovery_file, PackageType::TPK),
+            ci::AppInstaller::Result::OK);
+  CheckPackageNonExistance(pkgid, appid);
+}
+
+TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
+  bf::path path_old = "/usr/share/app-installers-ut/test_samples/smoke/RecoveryMode_Tpk_Update.tpk";  // NOLINT
+  bf::path path_new = "/usr/share/app-installers-ut/test_samples/smoke/RecoveryMode_Tpk_Update_2.tpk";  // NOLINT
+  RemoveAllRecoveryFiles();
+  ASSERT_DEATH(Update(path_old, path_new, PackageType::TPK,
+                      RequestResult::CRASH), ".*");
+
+  std::string pkgid = "smokeapp16";
+  std::string appid = "smokeapp16.RecoveryModeTpkUpdate";
+  bf::path recovery_file = FindRecoveryFile();
+  ASSERT_FALSE(recovery_file.empty());
+  ASSERT_EQ(Recover(recovery_file, PackageType::TPK),
+            ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid, PackageType::TPK);
+
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "VERSION", "1\n"));
+}
+
 }  // namespace common_installer
 
 int main(int argc,  char** argv) {
diff --git a/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Installation.tpk b/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Installation.tpk
new file mode 100644 (file)
index 0000000..9ef0e27
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Installation.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update.tpk b/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update.tpk
new file mode 100644 (file)
index 0000000..5a111e5
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update_2.tpk b/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update_2.tpk
new file mode 100644 (file)
index 0000000..22db6cb
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/RecoveryMode_Tpk_Update_2.tpk differ