[Pkg-owncloud-commits] [owncloud] 48/223: Added check and cleanup for storage/filecache

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:05 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 19c73a8464f26ec4f49b47fc4ba217b2c899b904
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Thu Jun 12 12:49:01 2014 +0200

    Added check and cleanup for storage/filecache
    
    Some tests don't clean up the file cache and sometimes entries are
    reused by mistake in subsequent test suites.
    
    This cleans up the file cache and storage after every test suite and
    also shows an annoying warning.
---
 tests/testcleanuplistener.php | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/testcleanuplistener.php b/tests/testcleanuplistener.php
index b544c8f..7065f03 100644
--- a/tests/testcleanuplistener.php
+++ b/tests/testcleanuplistener.php
@@ -41,6 +41,12 @@ class TestCleanupListener implements PHPUnit_Framework_TestListener {
 	}
 
 	public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
+		if ($this->cleanStorages() && $this->isShowSuiteWarning()) {
+			printf("TestSuite '%s': Did not clean up storages\n", $suite->getName());
+		}
+		if ($this->cleanFileCache() && $this->isShowSuiteWarning()) {
+			printf("TestSuite '%s': Did not clean up file cache\n", $suite->getName());
+		}
 		if ($this->cleanStrayDataFiles() && $this->isShowSuiteWarning()) {
 			printf("TestSuite '%s': Did not clean up data dir\n", $suite->getName());
 		}
@@ -114,6 +120,26 @@ class TestCleanupListener implements PHPUnit_Framework_TestListener {
 		return false;
 	}
 
+	private function cleanStorages() {
+		$sql = 'DELETE FROM `*PREFIX*storages`';
+		$query = \OC_DB::prepare( $sql );
+		$result = $query->execute();
+		if ($result > 0) {
+			return true;
+		}
+		return false;
+	}
+
+	private function cleanFileCache() {
+		$sql = 'DELETE FROM `*PREFIX*filecache`';
+		$query = \OC_DB::prepare( $sql );
+		$result = $query->execute();
+		if ($result > 0) {
+			return true;
+		}
+		return false;
+	}
+
 	private function cleanStrayHooks() {
 		$hasHooks = false;
 		$hooks = OC_Hook::getHooks();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list