-
Notifications
You must be signed in to change notification settings - Fork 465
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
[WFCORE-6532] Add security manager to script tests #5706
[WFCORE-6532] Add security manager to script tests #5706
Conversation
@Override | ||
void testScript(final ScriptProcess script) throws InterruptedException, TimeoutException, IOException { | ||
script.start(HOST_CONTROLLER_CHECK, ServerHelper.DEFAULT_SERVER_JAVA_OPTS); | ||
boolean isSecurityManagerEnabled = Boolean.parseBoolean(System.getProperty("security.manager")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should skip this check and just always test with the security manager enabled in one run. Currently we don't run security manager tests on Windows so we'd lose that testing.
final Collection<Object> result = new ArrayList<>(2); | ||
result.add(Collections.emptyMap()); | ||
result.add(Collections.singletonMap("SECMGR", "true")); | ||
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could simply be return List.of(Map.of(), Map.of("SECMGR", "true"));
.
@@ -89,7 +91,13 @@ void testScript(final ScriptProcess script) throws InterruptedException, Timeout | |||
// seem to work when a directory has a space. An error indicating the trailing quote cannot be found. Removing | |||
// the `\ parts and just keeping quotes ends in the error shown in JDK-8215398. | |||
Assume.assumeFalse(TestSuiteEnvironment.isWindows() && env.containsKey("GC_LOG") && script.getScript().toString().contains(" ")); | |||
script.start(STANDALONE_CHECK, env, ServerHelper.DEFAULT_SERVER_JAVA_OPTS); | |||
|
|||
boolean isSecurityManagerEnabled = Boolean.parseBoolean(System.getProperty("security.manager")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we should always do a run with the security manager enabled.
d48fe23
to
cc4aab7
Compare
String[] modifiedJavaOpts = Arrays.copyOf(ServerHelper.DEFAULT_SERVER_JAVA_OPTS, ServerHelper.DEFAULT_SERVER_JAVA_OPTS.length + 1); | ||
modifiedJavaOpts[modifiedJavaOpts.length - 1] = "-secmgr"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was clear with my wording here. We shouldn't be adding the -secmgr
parameter to the server arguments if we've already got it set in the environment variable. Essentially we could just do this:
script.start(HOST_CONTROLLER_CHECK, env, ServerHelper.DEFAULT_SERVER_JAVA_OPTS);
String[] modifiedJavaOpts = Arrays.copyOf(ServerHelper.DEFAULT_SERVER_JAVA_OPTS, ServerHelper.DEFAULT_SERVER_JAVA_OPTS.length + 1); | ||
modifiedJavaOpts[modifiedJavaOpts.length - 1] = "-secmgr"; | ||
script.start(STANDALONE_CHECK, env, modifiedJavaOpts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above here. The only change needed in this case is just to the data()
method where we add the "SECMGR", "true"
map entry.
cc4aab7
to
8a885e2
Compare
I see, no problem, it should be fixed now. |
@@ -6,6 +6,10 @@ | |||
package org.wildfly.scripts.test; | |||
|
|||
import java.io.IOException; | |||
import java.util.Arrays; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import is causing a checkstyle error as it's not used.
@@ -8,9 +8,8 @@ | |||
import java.io.IOException; | |||
import java.nio.file.Files; | |||
import java.nio.file.Path; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also causing a checkstyle issue and should be removed.
8a885e2
to
527ab79
Compare
Sorry, I don't know why it didn't show the checkstyle error when I compiled it. |
https://issues.redhat.com/browse/WFCORE-6532