Skip to content
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

JDK-8295756 Improve NonLocalRegistry Manual Test Process #10825

Closed
wants to merge 9 commits into from

Conversation

bwhuang-us
Copy link
Contributor

@bwhuang-us bwhuang-us commented Oct 21, 2022

The current non local registry tests require a manual process that runs rmiregitrty on a different machine and changes the -Dregistry.host property in the source before running the tests on the local machine. This task is created to improve this manual process and provide a clearer instruction to the test engineer about the test requirement.

Tests include:
java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java
java/rmi/registry/nonLocalRegistry/NonLocalRegistryTest.java
javax/management/remote/nonLocalAccess/NonLocalJMXRemoteTest.java


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8295756: Improve NonLocalRegistry Manual Test Process

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10825/head:pull/10825
$ git checkout pull/10825

Update a local copy of the PR:
$ git checkout pull/10825
$ git pull https://git.openjdk.org/jdk pull/10825/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10825

View PR using the GUI difftool:
$ git pr show -t 10825

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10825.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 21, 2022

👋 Welcome back bhuang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 21, 2022
@openjdk
Copy link

openjdk bot commented Oct 21, 2022

@bwhuang-us The following labels will be automatically applied to this pull request:

  • core-libs
  • jmx
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org jmx jmx-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Oct 21, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 21, 2022

@@ -200,6 +200,8 @@ jdk_time = \

jdk_rmi = \
java/rmi \
-java/rmi/registry/nonLocalRegistry/NonLocalRegistryTest.java \
-java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RunTests.gmk runs jtreg with -automatic so I don't think you need to exclude the manual tests from these test groups.

public class NonLocalRegistryBase {
static final String instructions =
"This is a manual test that requires rmiregistry run on a different host"
+ ". Login or ssh to a different host, install the latest JDK "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace "latest JDK" with "JDK under test"

@@ -154,4 +222,43 @@ private static void assertIsAccessException(Throwable ex) {
throw new RuntimeException("AccessException did not occur when expected", ex);
}
}

private String readHostInput(int index) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code, this code is also in NonLocalRegistryBase.java, Please move this code in a common class under lib/jdk/test/lib. Or move this NonLocalRegistryBase.java under lib/jdk/test/lib and provide some generic name.

*/
public class NonLocalRegistryTest {
public class NonLocalRegistryTest extends NonLocalRegistryBase {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move private static void assertIsAccessException(Throwable ex) method to NonLocalRegistryBase class.

@@ -76,12 +78,17 @@
* On the first host modify the @run command above to replace "rmi-registry-host"
* with the hostname or IP address of the different host and run the test with jtreg.
*/
public class NonLocalSkeletonTest {
public class NonLocalSkeletonTest extends NonLocalRegistryBase {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move private static void assertIsAccessException(Throwable ex) method to NonLocalRegistryBase class.

@@ -154,4 +222,43 @@ private static void assertIsAccessException(Throwable ex) {
throw new RuntimeException("AccessException did not occur when expected", ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private static void assertIsAccessException(Throwable ex) is define in all these three test classes, move this method in lib/jdk/test/lib

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is test dependent that checks for specific keywords in the AccessException. It seems better remain inside the test classes.

@mahendrachhipa
Copy link
Member

LGTM

Set<InetAddress> myAddrs =
Set.copyOf(Arrays.asList(InetAddress.getAllByName(myHostName)));
Set<InetAddress> hostAddrs =
Set.copyOf(Arrays.asList(InetAddress.getAllByName(host)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to change this from Set.of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for duplicate elements detected by Set.of(). On my localhost, InetAddress.getAllByName(localhost returns duplicate IPv6 addresses with different scoped id which is not counted during comparison. This change shouldn't impact the goal of these tests which is to verify that registry modification request from client side is prohibited.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. You might want to add a comment to avoid drive-by suggestions to simplify it.

@openjdk
Copy link

openjdk bot commented Nov 29, 2022

@bwhuang-us this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8295756
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Nov 29, 2022
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Nov 29, 2022
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 4, 2023

@bwhuang-us This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bwhuang-us bwhuang-us marked this pull request as draft January 17, 2023 18:13
@openjdk openjdk bot removed the rfr Pull request is ready for review label Jan 17, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 2, 2023

@bwhuang-us This pull request has been inactive for more than 16 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org jmx jmx-dev@openjdk.org serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants