Skip to content

Commit

Permalink
Fix permissions for test
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Maurya <[email protected]>
  • Loading branch information
rishabhmaurya committed Jan 21, 2025
1 parent 81c1e6f commit f0ad1fb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class FlightStreamPluginTests extends OpenSearchTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
settings = Settings.builder().put("node.attr.transport.stream.port", "9880").put(ARROW_STREAMS_SETTING.getKey(), true).build();
settings = Settings.builder().put(ARROW_STREAMS_SETTING.getKey(), true).build();
clusterService = mock(ClusterService.class);
ClusterState clusterState = mock(ClusterState.class);
DiscoveryNodes nodes = mock(DiscoveryNodes.class);
Expand All @@ -53,10 +53,7 @@ public void setUp() throws Exception {

public void testPluginEnableAndDisable() throws IOException {

Settings disabledSettings = Settings.builder()
.put("node.attr.transport.stream.port", "9880")
.put(ARROW_STREAMS_SETTING.getKey(), false)
.build();
Settings disabledSettings = Settings.builder().put(ARROW_STREAMS_SETTING.getKey(), false).build();
FeatureFlags.initializeFeatureFlags(disabledSettings);
FlightStreamPlugin disabledPlugin = new FlightStreamPlugin(disabledSettings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class ServerConfigTests extends OpenSearchTestCase {
public void setUp() throws Exception {
super.setUp();
settings = Settings.builder()
.put("node.attr.transport.stream.port", 9880)
.put("arrow.allocation.manager.type", "Netty")
.put("arrow.enable_null_check_for_get", false)
.put("arrow.enable_unsafe_memory_access", true)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

grant codeBase "${codebase.grpc-netty-shaded}" {
permission java.net.SocketPermission "*", "accept,connect,listen,resolve";
permission java.lang.RuntimePermission "*", "setContextClassLoader";
};

grant codeBase "${codebase.grpc-core}" {
permission java.net.SocketPermission "*", "accept,connect,listen,resolve";
permission java.lang.RuntimePermission "*", "setContextClassLoader";
};

grant {
// arrow flight service permissions
permission java.util.PropertyPermission "arrow.allocation.manager.type", "write";
permission java.util.PropertyPermission "arrow.enable_null_check_for_get", "write";
permission java.util.PropertyPermission "arrow.enable_unsafe_memory_access", "write";
permission java.util.PropertyPermission "arrow.memory.debug.allocator", "write";

permission java.util.PropertyPermission "io.netty.tryReflectionSetAccessible", "write";
permission java.util.PropertyPermission "io.netty.allocator.numDirectArenas", "write";
permission java.util.PropertyPermission "io.netty.noUnsafe", "write";
permission java.util.PropertyPermission "io.netty.tryUnsafe", "write";

// Needed for netty based arrow flight server for netty configs related to buffer allocator
permission java.security.AllPermission "modifyThreadGroup";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.util.PropertyPermission "arrow.allocation.manager.type", "write";
};

0 comments on commit f0ad1fb

Please sign in to comment.