ACCUMULO-3747 put IT in its place and give it a correct name
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/fc15de74 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/fc15de74 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/fc15de74 Branch: refs/heads/master Commit: fc15de748d2a02dba5fee4133c71f2645b6ae230 Parents: 2721bc8 Author: Keith Turner <ktur...@apache.org> Authored: Tue Jun 23 18:07:15 2015 -0400 Committer: Keith Turner <ktur...@apache.org> Committed: Tue Jun 23 18:07:15 2015 -0400 ---------------------------------------------------------------------- .../accumulo/test/DetectDeadTabletServers.java | 96 -------------------- .../test/DetectDeadTabletServersIT.java | 96 ++++++++++++++++++++ 2 files changed, 96 insertions(+), 96 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc15de74/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java deleted file mode 100644 index 15afd25..0000000 --- a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.test; - -import static org.apache.accumulo.minicluster.ServerType.TABLET_SERVER; -import static org.junit.Assert.assertEquals; - -import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.impl.MasterClient; -import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.master.thrift.MasterClientService; -import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; -import org.apache.accumulo.core.metadata.MetadataTable; -import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; -import org.apache.accumulo.fate.util.UtilWaitThread; -import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.accumulo.test.functional.ConfigurableMacIT; -import org.apache.accumulo.trace.instrument.Tracer; -import org.apache.hadoop.conf.Configuration; -import org.junit.Test; - -import com.google.common.collect.Iterators; - -public class DetectDeadTabletServers extends ConfigurableMacIT { - - @Override - protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { - cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s"); - } - - @Test - public void test() throws Exception { - Connector c = getConnector(); - log.info("verifying that everything is up"); - Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator()); - - MasterMonitorInfo stats = getStats(c); - assertEquals(2, stats.tServerInfo.size()); - assertEquals(0, stats.badTServers.size()); - assertEquals(0, stats.deadTabletServers.size()); - log.info("Killing a tablet server"); - getCluster().killProcess(TABLET_SERVER, getCluster().getProcesses().get(TABLET_SERVER).iterator().next()); - - while (true) { - stats = getStats(c); - if (2 != stats.tServerInfo.size()) { - break; - } - UtilWaitThread.sleep(500); - } - assertEquals(1, stats.tServerInfo.size()); - assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size()); - while (true) { - stats = getStats(c); - if (0 != stats.deadTabletServers.size()) { - break; - } - UtilWaitThread.sleep(500); - } - assertEquals(1, stats.tServerInfo.size()); - assertEquals(0, stats.badTServers.size()); - assertEquals(1, stats.deadTabletServers.size()); - } - - private MasterMonitorInfo getStats(Connector c) throws Exception { - Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); - MasterClientService.Iface client = null; - try { - client = MasterClient.getConnectionWithRetry(c.getInstance()); - log.info("Fetching master stats"); - return client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); - } finally { - if (client != null) { - MasterClient.close(client); - } - } - } - - -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc15de74/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java b/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java new file mode 100644 index 0000000..11fa06b --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.test; + +import static org.apache.accumulo.minicluster.ServerType.TABLET_SERVER; +import static org.junit.Assert.assertEquals; + +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.MasterClient; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.master.thrift.MasterClientService; +import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.security.Credentials; +import org.apache.accumulo.fate.util.UtilWaitThread; +import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; +import org.apache.accumulo.test.functional.ConfigurableMacIT; +import org.apache.accumulo.trace.instrument.Tracer; +import org.apache.hadoop.conf.Configuration; +import org.junit.Test; + +import com.google.common.collect.Iterators; + +public class DetectDeadTabletServersIT extends ConfigurableMacIT { + + @Override + protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { + cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s"); + } + + @Test + public void test() throws Exception { + Connector c = getConnector(); + log.info("verifying that everything is up"); + Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator()); + + MasterMonitorInfo stats = getStats(c); + assertEquals(2, stats.tServerInfo.size()); + assertEquals(0, stats.badTServers.size()); + assertEquals(0, stats.deadTabletServers.size()); + log.info("Killing a tablet server"); + getCluster().killProcess(TABLET_SERVER, getCluster().getProcesses().get(TABLET_SERVER).iterator().next()); + + while (true) { + stats = getStats(c); + if (2 != stats.tServerInfo.size()) { + break; + } + UtilWaitThread.sleep(500); + } + assertEquals(1, stats.tServerInfo.size()); + assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size()); + while (true) { + stats = getStats(c); + if (0 != stats.deadTabletServers.size()) { + break; + } + UtilWaitThread.sleep(500); + } + assertEquals(1, stats.tServerInfo.size()); + assertEquals(0, stats.badTServers.size()); + assertEquals(1, stats.deadTabletServers.size()); + } + + private MasterMonitorInfo getStats(Connector c) throws Exception { + Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); + MasterClientService.Iface client = null; + try { + client = MasterClient.getConnectionWithRetry(c.getInstance()); + log.info("Fetching master stats"); + return client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); + } finally { + if (client != null) { + MasterClient.close(client); + } + } + } + + +}