[FileBackend] Purge Swift process cache before container delete for sanity.
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 25 May 2012 10:40:56 +0000 (03:40 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 25 May 2012 10:41:12 +0000 (03:41 -0700)
* Also tweaked some documentation.

Change-Id: I89369d6211de216193ae1d895356137cacded5d7

includes/filerepo/backend/SwiftFileBackend.php
tests/phpunit/includes/filerepo/FileBackendTest.php

index 36d4334..d5e0c67 100644 (file)
@@ -1114,7 +1114,7 @@ class SwiftFileBackend extends FileBackendStore {
         *
         * @param $container string Container name
         * @return CF_Container
-        * @throws InvalidResponseException
+        * @throws CloudFilesException
         */
        protected function createContainer( $container ) {
                $conn = $this->getConnection(); // Swift proxy connection
@@ -1128,12 +1128,12 @@ class SwiftFileBackend extends FileBackendStore {
         *
         * @param $container string Container name
         * @return void
-        * @throws InvalidResponseException
+        * @throws CloudFilesException
         */
        protected function deleteContainer( $container ) {
                $conn = $this->getConnection(); // Swift proxy connection
-               $conn->delete_container( $container );
                unset( $this->connContainers[$container] ); // purge cache
+               $conn->delete_container( $container );
        }
 
        /**
index 2b94778..710ad83 100644 (file)
@@ -1392,8 +1392,11 @@ class FileBackendTest extends MediaWikiTestCase {
 
        private function doTestGetFileList() {
                $backendName = $this->backendClass();
-
                $base = $this->baseStorePath();
+
+               // Should have no errors
+               $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont-notexists" ) );
+
                $files = array(
                        "$base/unittest-cont1/test1.txt",
                        "$base/unittest-cont1/test2.txt",