Add error checking to test_access_scanner 12/69012/6
authorDave Rigby <daver@couchbase.com>
Mon, 17 Oct 2016 13:32:26 +0000 (14:32 +0100)
committerDave Rigby <daver@couchbase.com>
Mon, 31 Oct 2016 14:49:48 +0000 (14:49 +0000)
test_access_scanner doesn't check if store() has actually succeeded
when populating data. Fix this.

Change-Id: Ibd4f97b3b47c15b81a7671d5ed32c15aa4796a40
Reviewed-on: http://review.couchbase.org/69012
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
tests/ep_testsuite.cc

index db60da5..59091ec 100644 (file)
@@ -2806,10 +2806,24 @@ static enum test_result test_access_scanner(ENGINE_HANDLE *h,
         std::string key("key" + std::to_string(num_items));
         ENGINE_ERROR_CODE ret = store(h, h1, NULL, OPERATION_SET,
                                       key.c_str(), "somevalue", &itm);
-        if (ret == ENGINE_SUCCESS) {
-            num_items++;
+        switch (ret) {
+            case ENGINE_SUCCESS:
+                num_items++;
+                h1->release(h, NULL, itm);
+                break;
+
+            case ENGINE_ENOMEM:
+            case ENGINE_TMPFAIL:
+                // Returned when at high watermark; simply retry the op.
+                h1->release(h, NULL, itm);
+                break;
+
+            default:
+                fprintf(stderr, "test_access_scanner: Unexpected result from store(): %d\n",
+                        ret);
+                abort();
         }
-        h1->release(h, NULL, itm);
+
     }
 
     wait_for_flusher_to_settle(h, h1);