Giter Site home page Giter Site logo

Comments (2)

DomGarguilo avatar DomGarguilo commented on May 17, 2024

As part of completing this ticket, the following code should be removed/replaced with the built in functionality of AccumuloITBase.getUniqueNames() from accumulo 2.1

private String testName;
private String[] getUniqueNameArray(int num) {
String[] names = new String[num];
for (int i = 0; i < num; i++)
names[i] = this.getClass().getSimpleName() + "_" + testName + i;
return names;
}
@BeforeEach
public void setup(TestInfo info) throws Exception {
// Create a new client for each test
if (isKerberosEnabled()) {
UserGroupInformation.loginUserFromKeytab(clientPrincipal, clientKeytab.getAbsolutePath());
proxyClient = new TestProxyClient(hostname, proxyPort, factory, proxyPrimary,
UserGroupInformation.getCurrentUser());
client = proxyClient.proxy();
creds = client.login(clientPrincipal, properties);
TestingKdc kdc = getKdc();
final ClusterUser user = kdc.getClientPrincipal(0);
// Create another user
client.createLocalUser(creds, user.getPrincipal(), s2bb("unused"));
// Login in as that user we just created
UserGroupInformation.loginUserFromKeytab(user.getPrincipal(),
user.getKeytab().getAbsolutePath());
final UserGroupInformation badUgi = UserGroupInformation.getCurrentUser();
// Get a "Credentials" object for the proxy
TestProxyClient badClient = new TestProxyClient(hostname, proxyPort, factory, proxyPrimary,
badUgi);
try {
Client badProxy = badClient.proxy();
badLogin = badProxy.login(user.getPrincipal(), properties);
} finally {
badClient.close();
}
// Log back in as the test user
UserGroupInformation.loginUserFromKeytab(clientPrincipal, clientKeytab.getAbsolutePath());
// Drop test user, invalidating the credentials (not to mention not having the krb credentials
// anymore)
client.dropLocalUser(creds, user.getPrincipal());
} else {
proxyClient = new TestProxyClient(hostname, proxyPort, factory);
client = proxyClient.proxy();
creds = client.login("root", properties);
// Create 'user'
client.createLocalUser(creds, "user", s2bb(SharedMiniClusterBase.getRootPassword()));
// Log in as 'user'
badLogin = client.login("user", properties);
// Drop 'user', invalidating the credentials
client.dropLocalUser(creds, "user");
}
testName = info.getTestMethod().get().getName();
// Create some unique names for tables, namespaces, etc.
String[] uniqueNames = getUniqueNameArray(2);
// Create a general table to be used
tableName = uniqueNames[0];
client.createTable(creds, tableName, true, TimeType.MILLIS);
// Create a general namespace to be used
namespaceName = uniqueNames[1];
client.createNamespace(creds, namespaceName);
}
@AfterEach
public void teardown() throws Exception {
if (tableName != null) {
if (isKerberosEnabled()) {
UserGroupInformation.loginUserFromKeytab(clientPrincipal, clientKeytab.getAbsolutePath());
}
try {
if (client.tableExists(creds, tableName)) {
client.deleteTable(creds, tableName);
}
} catch (Exception e) {
log.warn("Failed to delete test table", e);
}
}
if (namespaceName != null) {
try {
if (client.namespaceExists(creds, namespaceName)) {
client.deleteNamespace(creds, namespaceName);
}
} catch (Exception e) {
log.warn("Failed to delete test namespace", e);
}
}
// Close the transport after the test
if (proxyClient != null) {
proxyClient.close();
}
}
/*
* Set a lower timeout for tests that should fail fast
*/
@Test
@Timeout(5)
public void addConstraintLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.addConstraint(badLogin, tableName, NumericValueConstraint.class.getName()));
}
@Test
@Timeout(5)
public void addSplitsLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.addSplits(badLogin, tableName, Collections.singleton(s2bb("1"))));
}
@Test
@Timeout(5)
public void clearLocatorCacheLoginFailure() {
assertThrows(TApplicationException.class, () -> client.clearLocatorCache(badLogin, tableName));
}
@Test
@Timeout(5)
public void compactTableLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class,
() -> client.compactTable(badLogin, tableName, null, null, null, true, false, null));
}
@Test
@Timeout(5)
public void cancelCompactionLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.cancelCompaction(badLogin, tableName));
}
@Test
@Timeout(5)
public void createTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.createTable(badLogin, tableName, false, TimeType.MILLIS));
}
@Test
@Timeout(5)
public void deleteTableLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.deleteTable(badLogin, tableName));
}
@Test
@Timeout(5)
public void deleteRowsLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class,
() -> client.deleteRows(badLogin, tableName, null, null));
}
@Test
@Timeout(5)
public void tableExistsLoginFailure() {
assertThrows(TApplicationException.class, () -> client.tableExists(badLogin, tableName));
}
@Test
@Timeout(5)
public void flustTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.flushTable(badLogin, tableName, null, null, false));
}
@Test
@Timeout(5)
public void getLocalityGroupsLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.getLocalityGroups(badLogin, tableName));
}
@Test
@Timeout(5)
public void getMaxRowLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class, () -> client.getMaxRow(badLogin, tableName,
Collections.<ByteBuffer> emptySet(), null, false, null, false));
}
@Test
@Timeout(5)
public void getTablePropertiesLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.getTableProperties(badLogin, tableName));
}
@Test
@Timeout(5)
public void listSplitsLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class,
() -> client.listSplits(badLogin, tableName, 10000));
}
@Test
@Timeout(5)
public void listTablesLoginFailure() {
assertThrows(TApplicationException.class, () -> client.listTables(badLogin));
}
@Test
@Timeout(5)
public void listConstraintsLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class,
() -> client.listConstraints(badLogin, tableName));
}
@Test
@Timeout(5)
public void mergeTabletsLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.mergeTablets(badLogin, tableName, null, null));
}
@Test
@Timeout(5)
public void offlineTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.offlineTable(badLogin, tableName, false));
}
@Test
@Timeout(5)
public void onlineTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.onlineTable(badLogin, tableName, false));
}
@Test
@Timeout(5)
public void removeConstraintLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.removeConstraint(badLogin, tableName, 0));
}
@Test
@Timeout(5)
public void removeTablePropertyLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.removeTableProperty(badLogin, tableName, Property.TABLE_FILE_MAX.getKey()));
}
@Test
@Timeout(5)
public void renameTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.renameTable(badLogin, tableName, "someTableName"));
}
@Test
@Timeout(5)
public void setLocalityGroupsLoginFailure() {
Map<String,Set<String>> groups = new HashMap<>();
groups.put("group1", Collections.singleton("cf1"));
groups.put("group2", Collections.singleton("cf2"));
assertThrows(AccumuloSecurityException.class,
() -> client.setLocalityGroups(badLogin, tableName, groups));
}
@Test
@Timeout(5)
public void setTablePropertyLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.setTableProperty(badLogin, tableName, Property.TABLE_FILE_MAX.getKey(), "0"));
}
@Test
@Timeout(5)
public void tableIdMapLoginFailure() {
assertThrows(TException.class, () -> client.tableIdMap(badLogin));
}
@Test
@Timeout(5)
public void getSiteConfigurationLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class, () -> client.getSiteConfiguration(badLogin));
}
@Test
@Timeout(5)
public void getSystemConfigurationLoginFailure() throws Exception {
assertThrows(AccumuloSecurityException.class, () -> client.getSystemConfiguration(badLogin));
}
@Test
@Timeout(5)
public void getTabletServersLoginFailure() {
assertThrows(TException.class, () -> client.getTabletServers(badLogin));
}
@Test
@Timeout(5)
public void getActiveScansLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.getActiveScans(badLogin, "fake"));
}
@Test
@Timeout(5)
public void getActiveCompactionsLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.getActiveCompactions(badLogin, "fake"));
}
@Test
@Timeout(5)
public void removePropertyLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.removeProperty(badLogin, "table.split.threshold"));
}
@Test
@Timeout(5)
public void setPropertyLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.setProperty(badLogin, "table.split.threshold", "500M"));
}
@Test
@Timeout(5)
public void testClassLoadLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.testClassLoad(badLogin,
DevNull.class.getName(), SortedKeyValueIterator.class.getName()));
}
@Test
@Timeout(5)
public void authenticateUserLoginFailure() {
if (!isKerberosEnabled()) {
// Not really a relevant test for kerberos
Map<String,String> pw = s2pp(SharedMiniClusterBase.getRootPassword());
assertThrows(AccumuloSecurityException.class,
() -> client.authenticateUser(badLogin, "root", pw));
}
}
@Test
@Timeout(5)
public void changeUserAuthorizationsLoginFailure() {
HashSet<ByteBuffer> auths = new HashSet<>(Arrays.asList(s2bb("A"), s2bb("B")));
assertThrows(AccumuloSecurityException.class,
() -> client.changeUserAuthorizations(badLogin, "stooge", auths));
}
@Test
@Timeout(5)
public void changePasswordLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.changeLocalUserPassword(badLogin, "stooge", s2bb("")));
}
@Test
@Timeout(5)
public void createUserLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.createLocalUser(badLogin, "stooge", s2bb("password")));
}
@Test
@Timeout(5)
public void dropUserLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.dropLocalUser(badLogin, "stooge"));
}
@Test
@Timeout(5)
public void getUserAuthorizationsLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.getUserAuthorizations(badLogin, "stooge"));
}
@Test
@Timeout(5)
public void grantSystemPermissionLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.grantSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE));
}
@Test
@Timeout(5)
public void grantTablePermissionLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.grantTablePermission(badLogin, "root", tableName, TablePermission.WRITE));
}
@Test
@Timeout(5)
public void hasSystemPermissionLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.hasSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE));
}
@Test
@Timeout(5)
public void hasTablePermission() {
assertThrows(AccumuloSecurityException.class,
() -> client.hasTablePermission(badLogin, "root", tableName, TablePermission.WRITE));
}
@Test
@Timeout(5)
public void listLocalUsersLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.listLocalUsers(badLogin));
}
@Test
@Timeout(5)
public void revokeSystemPermissionLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.revokeSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE));
}
@Test
@Timeout(5)
public void revokeTablePermissionLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.revokeTablePermission(badLogin,
"root", tableName, TablePermission.ALTER_TABLE));
}
@Test
@Timeout(5)
public void createScannerLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.createScanner(badLogin, tableName, new ScanOptions()));
}
@Test
@Timeout(5)
public void createBatchScannerLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.createBatchScanner(badLogin, tableName, new BatchScanOptions()));
}
@Test
@Timeout(5)
public void updateAndFlushLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.updateAndFlush(badLogin, tableName, new HashMap<>()));
}
@Test
@Timeout(5)
public void createWriterLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.createWriter(badLogin, tableName, new WriterOptions()));
}
@Test
@Timeout(5)
public void attachIteratorLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.attachIterator(badLogin, "slow", setting, EnumSet.allOf(IteratorScope.class)));
}
@Test
@Timeout(5)
public void checkIteratorLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.checkIteratorConflicts(badLogin,
tableName, setting, EnumSet.allOf(IteratorScope.class)));
}
@Test
@Timeout(5)
public void cloneTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.cloneTable(badLogin, tableName, tableName + "_clone", false, null, null));
}
@Test
@Timeout(5)
public void exportTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.exportTable(badLogin, tableName, "/tmp"));
}
@Test
@Timeout(5)
public void importTableLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.importTable(badLogin, "testify", "/tmp"));
}
@Test
@Timeout(5)
public void getIteratorSettingLoginFailure() {
assertThrows(AccumuloSecurityException.class,
() -> client.getIteratorSetting(badLogin, tableName, "foo", IteratorScope.SCAN));
}
@Test
@Timeout(5)
public void listIteratorsLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.listIterators(badLogin, tableName));
}
@Test
@Timeout(5)
public void removeIteratorLoginFailure() {
assertThrows(AccumuloSecurityException.class, () -> client.removeIterator(badLogin, tableName,
"name", EnumSet.allOf(IteratorScope.class)));
}
@Test

This code was added in #38 so that we could get unique names for resources within the tests. The method above was essentially copied from AccumuloITBase. This needed to be done since the difference in JUnit versions between accumulo and accumulo-proxy was causing issues with getUniqueNames().

from accumulo-proxy.

DomGarguilo avatar DomGarguilo commented on May 17, 2024

I am in the process of getting things working with 2.1 but am running into some issues that I'm having trouble debugging. So far I've updated accumulo to version 2.1 and thrift to version 0.17 to match accumulo. When running the ITs, TCompactProxyIT passes fine but the other 3 ITs fail.
TTupleProxyIT fails with:

org.apache.thrift.TApplicationException: don't know what type: 15

	at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:81)
	at org.apache.accumulo.proxy.thrift.AccumuloProxy$Client.recv_login(AccumuloProxy.java:476)
	at org.apache.accumulo.proxy.thrift.AccumuloProxy$Client.login(AccumuloProxy.java:462)
	at org.apache.accumulo.proxy.its.SimpleProxyBase.setup(SimpleProxyBase.java:320)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.api.AssertTimeoutPreemptively.lambda$submitTask$3(AssertTimeoutPreemptively.java:95)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

TJsonProtocolProxyIT and TBinartProxtIT fail with:

org.apache.thrift.transport.TTransportException: Socket is closed by peer.

	at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:176)
	at org.apache.thrift.transport.TTransport.readAll(TTransport.java:100)
	at org.apache.thrift.transport.layered.TFramedTransport.readFrame(TFramedTransport.java:132)
	at org.apache.thrift.transport.layered.TFramedTransport.read(TFramedTransport.java:100)
	at org.apache.thrift.transport.TTransport.readAll(TTransport.java:100)
	at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:457)
	at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:359)
	at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:243)
	at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79)
	at org.apache.accumulo.proxy.thrift.AccumuloProxy$Client.recv_login(AccumuloProxy.java:476)
	at org.apache.accumulo.proxy.thrift.AccumuloProxy$Client.login(AccumuloProxy.java:462)
	at org.apache.accumulo.proxy.its.SimpleProxyBase.setup(SimpleProxyBase.java:320)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.api.AssertTimeoutPreemptively.lambda$submitTask$3(AssertTimeoutPreemptively.java:95)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

The only difference between the ITs is which TCompactProtocol.Factory is used.

I can't make much sense of what these exceptions mean and was hoping someone might have some ideas whats going on here.

from accumulo-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.