improve memcached test

This commit is contained in:
kimchy 2010-07-20 21:12:26 +03:00
parent 1ff8b43aa7
commit 300f38ee3c
1 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.memcached.test; package org.elasticsearch.memcached.test;
import net.spy.memcached.MemcachedClient; import net.spy.memcached.MemcachedClient;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterMethod;
@ -62,6 +63,9 @@ public abstract class AbstractMemcachedActionsTests {
Future<Boolean> setResult = memcachedClient.set("/test/person/1", 0, jsonBuilder().startObject().field("test", "value").endObject().copiedBytes()); Future<Boolean> setResult = memcachedClient.set("/test/person/1", 0, jsonBuilder().startObject().field("test", "value").endObject().copiedBytes());
assertThat(setResult.get(10, TimeUnit.SECONDS), equalTo(true)); assertThat(setResult.get(10, TimeUnit.SECONDS), equalTo(true));
ClusterHealthResponse health = node.client().admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
assertThat(health.timedOut(), equalTo(false));
String getResult = (String) memcachedClient.get("/_refresh"); String getResult = (String) memcachedClient.get("/_refresh");
System.out.println("REFRESH " + getResult); System.out.println("REFRESH " + getResult);
assertThat(getResult, Matchers.containsString("\"total\":10")); assertThat(getResult, Matchers.containsString("\"total\":10"));