-
Notifications
You must be signed in to change notification settings - Fork 479
Fix #1084 partial - IT tests failing on Standalone #1164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,9 @@ | |
|
|
||
| import java.util.Map.Entry; | ||
| import java.util.Properties; | ||
| import java.util.Set; | ||
|
|
||
| import org.apache.accumulo.cluster.ClusterUser; | ||
| import org.apache.accumulo.core.client.Accumulo; | ||
| import org.apache.accumulo.core.client.AccumuloClient; | ||
| import org.apache.accumulo.core.client.BatchWriter; | ||
|
|
@@ -40,12 +42,28 @@ | |
| import org.apache.accumulo.core.singletons.SingletonManager; | ||
| import org.apache.accumulo.core.singletons.SingletonManager.Mode; | ||
| import org.apache.accumulo.harness.AccumuloClusterHarness; | ||
| import org.junit.After; | ||
| import org.junit.Test; | ||
|
|
||
| import com.google.common.collect.Iterables; | ||
|
|
||
| public class AccumuloClientIT extends AccumuloClusterHarness { | ||
|
|
||
| @After | ||
| public void deleteUsers() throws Exception { | ||
| try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) { | ||
| Set<String> users = client.securityOperations().listLocalUsers(); | ||
| ClusterUser user1 = getUser(0); | ||
| ClusterUser user2 = getUser(1); | ||
| if (users.contains(user1.getPrincipal())) { | ||
| client.securityOperations().dropLocalUser(user1.getPrincipal()); | ||
| } | ||
| if (users.contains(user2.getPrincipal())) { | ||
| client.securityOperations().dropLocalUser(user2.getPrincipal()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private interface CloseCheck { | ||
| void check() throws Exception; | ||
| } | ||
|
|
@@ -78,49 +96,53 @@ public void testAccumuloClientBuilder() throws Exception { | |
| AccumuloClient c = Accumulo.newClient().from(getClientProps()).build(); | ||
| String instanceName = getClientInfo().getInstanceName(); | ||
| String zookeepers = getClientInfo().getZooKeepers(); | ||
| final String user = "testuser"; | ||
| final String password = "testpassword"; | ||
| c.securityOperations().createLocalUser(user, new PasswordToken(password)); | ||
|
|
||
| AccumuloClient client = Accumulo.newClient().to(instanceName, zookeepers).as(user, password) | ||
| ClusterUser testuser1 = getUser(0); | ||
| final String user1 = testuser1.getPrincipal(); | ||
| final String password1 = testuser1.getPassword(); | ||
| c.securityOperations().createLocalUser(user1, new PasswordToken(password1)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of the ClusterUser abstraction is to allow test to work with passwords or kerberose. For this test to work with kerberose it should not use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I'll assume a kerberose check is needed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind, this is not as simple as I thought. I was thinking |
||
|
|
||
| AccumuloClient client = Accumulo.newClient().to(instanceName, zookeepers).as(user1, password1) | ||
| .zkTimeout(1234).build(); | ||
|
|
||
| Properties props = client.properties(); | ||
| assertFalse(props.containsKey(ClientProperty.AUTH_TOKEN.getKey())); | ||
| ClientInfo info = ClientInfo.from(client.properties()); | ||
| assertEquals(instanceName, info.getInstanceName()); | ||
| assertEquals(zookeepers, info.getZooKeepers()); | ||
| assertEquals(user, client.whoami()); | ||
| assertEquals(user1, client.whoami()); | ||
| assertEquals(1234, info.getZooKeepersSessionTimeOut()); | ||
|
|
||
| props = Accumulo.newClientProperties().to(instanceName, zookeepers).as(user, password).build(); | ||
| props = | ||
| Accumulo.newClientProperties().to(instanceName, zookeepers).as(user1, password1).build(); | ||
| assertTrue(props.containsKey(ClientProperty.AUTH_TOKEN.getKey())); | ||
| assertEquals(password, props.get(ClientProperty.AUTH_TOKEN.getKey())); | ||
| assertEquals(password1, props.get(ClientProperty.AUTH_TOKEN.getKey())); | ||
| assertEquals("password", props.get(ClientProperty.AUTH_TYPE.getKey())); | ||
| assertEquals(instanceName, props.getProperty(ClientProperty.INSTANCE_NAME.getKey())); | ||
| info = ClientInfo.from(props); | ||
| assertEquals(instanceName, info.getInstanceName()); | ||
| assertEquals(zookeepers, info.getZooKeepers()); | ||
| assertEquals(user, info.getPrincipal()); | ||
| assertEquals(user1, info.getPrincipal()); | ||
| assertTrue(info.getAuthenticationToken() instanceof PasswordToken); | ||
|
|
||
| props = new Properties(); | ||
| props.put(ClientProperty.INSTANCE_NAME.getKey(), instanceName); | ||
| props.put(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), zookeepers); | ||
| props.put(ClientProperty.AUTH_PRINCIPAL.getKey(), user); | ||
| props.put(ClientProperty.AUTH_PRINCIPAL.getKey(), user1); | ||
| props.put(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT.getKey(), "22s"); | ||
| ClientProperty.setPassword(props, password); | ||
| ClientProperty.setPassword(props, password1); | ||
| client.close(); | ||
| client = Accumulo.newClient().from(props).build(); | ||
|
|
||
| info = ClientInfo.from(client.properties()); | ||
| assertEquals(instanceName, info.getInstanceName()); | ||
| assertEquals(zookeepers, info.getZooKeepers()); | ||
| assertEquals(user, client.whoami()); | ||
| assertEquals(user1, client.whoami()); | ||
| assertEquals(22000, info.getZooKeepersSessionTimeOut()); | ||
|
|
||
| final String user2 = "testuser2"; | ||
| final String password2 = "testpassword2"; | ||
| ClusterUser testuser2 = getUser(1); | ||
| final String user2 = testuser2.getPrincipal(); | ||
| final String password2 = testuser2.getPassword(); | ||
| c.securityOperations().createLocalUser(user2, new PasswordToken(password2)); | ||
|
|
||
| AccumuloClient client2 = Accumulo.newClient().from(client.properties()) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,15 +32,19 @@ | |
| import org.apache.accumulo.core.client.Accumulo; | ||
| import org.apache.accumulo.core.client.AccumuloClient; | ||
| import org.apache.accumulo.core.client.BatchWriter; | ||
| import org.apache.accumulo.core.client.admin.InstanceOperations; | ||
| import org.apache.accumulo.core.conf.Property; | ||
| import org.apache.accumulo.core.data.Mutation; | ||
| import org.apache.accumulo.harness.AccumuloClusterHarness; | ||
| import org.apache.accumulo.minicluster.ServerType; | ||
| import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; | ||
| import org.apache.accumulo.server.ServerContext; | ||
| import org.apache.accumulo.server.log.WalStateManager.WalState; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.fs.RawLocalFileSystem; | ||
| import org.apache.hadoop.io.Text; | ||
| import org.junit.After; | ||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
@@ -49,6 +53,8 @@ public class ManyWriteAheadLogsIT extends AccumuloClusterHarness { | |
|
|
||
| private static final Logger log = LoggerFactory.getLogger(ManyWriteAheadLogsIT.class); | ||
|
|
||
| private String majcDelay, walogSize; | ||
|
|
||
| @Override | ||
| public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { | ||
| // configure a smaller walog size so the walogs will roll frequently in the test | ||
|
|
@@ -71,6 +77,38 @@ protected int defaultTimeoutSeconds() { | |
| return 10 * 60; | ||
| } | ||
|
|
||
| @Before | ||
| public void alterConfig() throws Exception { | ||
| if (getClusterType() == ClusterType.MINI) { | ||
| return; | ||
| } | ||
| try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) { | ||
| InstanceOperations iops = client.instanceOperations(); | ||
| Map<String,String> conf = iops.getSystemConfiguration(); | ||
| majcDelay = conf.get(Property.TSERV_MAJC_DELAY.getKey()); | ||
| walogSize = conf.get(Property.TSERV_WALOG_MAX_SIZE.getKey()); | ||
|
|
||
| iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1"); | ||
| iops.setProperty(Property.TSERV_WALOG_MAX_SIZE.getKey(), "1M"); | ||
|
|
||
| getClusterControl().stopAllServers(ServerType.TABLET_SERVER); | ||
| getClusterControl().startAllServers(ServerType.TABLET_SERVER); | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you just put this in configureMiniCluster()? Or does it have to be before configureMiniCluster is called?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting solution for the standalone case. However, if it is necessary to alter the configuration of the system for the test, then it is probably not suitable for a standalone test, and should be recategorized so as to be skipped when running against a standalone instance.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @milleruntime configureMiniCluster() is called when a MAC is used. In this case we are running standalone so it would not be called. |
||
|
|
||
| @After | ||
| public void resetConfig() throws Exception { | ||
| if (majcDelay != null) { | ||
| try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) { | ||
| InstanceOperations iops = client.instanceOperations(); | ||
| iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay); | ||
| iops.setProperty(Property.TSERV_WALOG_MAX_SIZE.getKey(), walogSize); | ||
| } | ||
| getClusterControl().stopAllServers(ServerType.TABLET_SERVER); | ||
| getClusterControl().startAllServers(ServerType.TABLET_SERVER); | ||
| } | ||
| } | ||
|
|
||
keith-turner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * This creates a situation where many tablets reference many different write ahead logs. However | ||
| * not single tablet references a lot of write ahead logs. Want to ensure the tablet server forces | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.