ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
}
+TEST_F(RollbackSmokeTest, UpdateMode_RollbackSharedDataUpdate) {
+ bf::path path_old = kSmokePackagesDirectory / "UpdateMode_SharedData.tpk";
+ bf::path path_new = kSmokePackagesDirectory / "UpdateMode_SharedData_2.tpk";
+ std::string pkgid = "smoketpk.shareddata";
+ std::string appid = "smoketpk.shareddata";
+ std::string exec = "shareddata";
+ ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(backend.Install(path_new), ci::AppInstaller::Result::ERROR);
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(CheckSharedDataExistance(pkgid, params));
+}
+
+TEST_F(RollbackSmokeTest, UpdateMode_RollbackNonSharedDataUpdate) {
+ bf::path path_old = kSmokePackagesDirectory / "UpdateMode_NonSharedData.tpk";
+ bf::path path_new = kSmokePackagesDirectory / "UpdateMode_NonSharedData_2.tpk";
+ std::string pkgid = "smoketpk.non-shareddata";
+ std::string appid = "smoketpk.non-shareddata";
+ std::string exec = "shareddata";
+ ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(backend.Install(path_new), ci::AppInstaller::Result::ERROR);
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(CheckSharedDataNonExistance(pkgid, params));
+}
+
+TEST_F(SmokeTest, RecoveryMode_SharedDataUpdate) {
+ bf::path path_old =
+ kSmokePackagesDirectory / "RecoveryMode_SharedData.tpk";
+ bf::path path_new =
+ kSmokePackagesDirectory / "RecoveryMode_SharedData_2.tpk";
+ RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
+ ASSERT_EQ(backend.Install(path_old), ci::AppInstaller::Result::OK);
+ ci::Subprocess backend_crash("/usr/bin/tpk-backend-ut/smoke-test-helper");
+ std::string test_uid_str = std::to_string(params.test_user.uid);
+ backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
+ ASSERT_NE(backend_crash.Wait(), 0);
+
+ std::string pkgid = "smoketpk.recovery-shareddata";
+ std::string appid = "smoketpk.recovery-shareddata";
+ std::string exec = "shareddata";
+ bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
+ params.test_user.uid);
+ ASSERT_FALSE(recovery_file.empty());
+ ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
+
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(CheckSharedDataExistance(pkgid, params));
+}
+
+TEST_F(SmokeTest, RecoveryMode_NonSharedDataUpdate) {
+ bf::path path_old =
+ kSmokePackagesDirectory / "RecoveryMode_NonSharedData.tpk";
+ bf::path path_new =
+ kSmokePackagesDirectory / "RecoveryMode_NonSharedData_2.tpk";
+ RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
+ ASSERT_EQ(backend.Install(path_old), ci::AppInstaller::Result::OK);
+ ci::Subprocess backend_crash("/usr/bin/tpk-backend-ut/smoke-test-helper");
+ std::string test_uid_str = std::to_string(params.test_user.uid);
+ backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
+ ASSERT_NE(backend_crash.Wait(), 0);
+
+ std::string pkgid = "smoketpk.recovery-non-shareddata";
+ std::string appid = "smoketpk.recovery-non-shareddata";
+ std::string exec = "shareddata";
+ bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
+ params.test_user.uid);
+ ASSERT_FALSE(recovery_file.empty());
+ ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
+
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(CheckSharedDataNonExistance(pkgid, params));
+}
+
} // namespace smoke_test
int main(int argc, char** argv) {