Permalink
Browse files

Enable flush test for OO

Catch the correct exception to detect if if the test
environment allows flush to be executed.

Change-Id: I93397655fdc0b51073a27110355d7508c1d00f02
Reviewed-on: http://review.couchbase.org/23459
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent e128150 commit b4ceb4378459a67e71af0885b3ff3b54dfbfc271 @trondn trondn committed Dec 20, 2012
Showing with 18 additions and 13 deletions.
  1. +18 −13 tests/Flush.inc
View
@@ -12,7 +12,7 @@ class Flush extends CouchbaseTestCommon {
$key = $this->mk_key();
$val = uniqid('couchbase-value-');
-
+
$cas = $oo->set($key, $val);
return array($oo, $key, $val, $cas);
@@ -32,36 +32,41 @@ class Flush extends CouchbaseTestCommon {
}
/**
- * @test flush
+ * @test flush (oo)
*
* @pre
* setup run
*
* @post
* key is not set
*/
- function testFlush() {
- $this->markTestSkipped("Flush command is currently inaccessible");
-
+ function testFlushOO() {
list($oo, $key, $val, $cas) = $this->_test_setup_common_oo();
-
- $oo->flush();
-
- $this->assertNull($oo->get($key));
+ try {
+ $oo->flush();
+ $this->assertNull($oo->get($key));
+ } catch (CouchbaseAuthenticationException $exp) {
+ $this->markTestSkipped("Flush command is currently inaccessible (need auth)");
+ } catch (CouchbaseServerException $exp) {
+ if (preg_match("/Flush is disabled for the bucket/", $exp->getMessage())) {
+ $this->markTestSkipped("Flush command is currently inaccessible (not enabled)");
+ } else {
+ die("Failed to flush bucket: " . $exp->getMessage() . "\n");
+ }
+ }
}
/**
- * @test flush (oo)
+ * @test flush
*
- * @pre
+ * @pre
* setup run
*
* @post
* key is not set
*/
- function testFlushOO() {
+ function testFlush() {
$this->markTestSkipped("Flush command is currently inaccessible");
-
list($h, $key, $val, $cas) = $this->_test_setup_common();
couchbase_flush($h);

0 comments on commit b4ceb43

Please sign in to comment.