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
GEODE-6183: Fix isAttachAPIFound and launcher tests #3650
GEODE-6183: Fix isAttachAPIFound and launcher tests #3650
Conversation
22aa84e
to
675c816
Compare
675c816
to
3d3e547
Compare
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.
I haven't reviewed all of the formatting cleanup, but the actual bug fix looks good. Many thanks for separating out the code cleanup from the actual fix!
This is beyond the scope of this PR, but we really shouldn't be using this Attach API at all. There are way better and more standard ways to interact with a process we've launched.
@upthewaterspout I think the only feature we're still using in Attach API that isn't available elsewhere is the check |
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.
Yay code cleanup (and the fix too)! Is there an existing Geode JIRA story for @upthewaterspout 's point about not using this?
Maybe: |
@metatype What API is ProcessHandle part of? My IntelliJ project cannot find that class. Also, please update https://issues.apache.org/jira/browse/GEODE-6841 with any info on alternative APIs. Please provide a review as well (we need 3) -- thanks! EDIT: Looks like |
geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java
Show resolved
Hide resolved
...rc/integrationTest/java/org/apache/geode/distributed/ServerLauncherLocalIntegrationTest.java
Show resolved
Hide resolved
I might be archaic in my thinking or understanding, but I thought there was some guidance that was once provided that inherited Test classes were a smell. If so, I do see quite a few of the test classes use inheritance, which makes this review harder, as I would now have to go back to source code to understand what a specific method would be providing. |
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.
The locator integration test changes look fine. There's no diff for the distributed system integration test - can't tell what changed there. As for the original commit/fix it looks okay to me but I'm not familiar with the Attach API
@kohlmu-pivotal If I have a class called LocatorLauncher, then I create a unit test in src/test called LocatorLauncherTest and an integration test in src/integrationTest called LocatorLauncherIntegrationTest. I use those names simply because I want to. That's what I documented on the Geode wiki in the past and have been using for years. |
@bschuchardt The diff for DistributedSystemIntegrationTest is 4th commit down in the commits tab. Here's a URL to it: e3d8cfb |
@kohlmu-pivotal Re: inherited test classes: These are not new tests that I just recently decided to create with multiple-class inheritance. I simply cleaned them up. I'm not going to rewrite them from scratch, but you certainly can if you really want to. |
@kirklund I thought that we had an |
assertEquals(GemFireCacheImpl.getInstance().getMyId(), | ||
alreadyManaging.get(0).getDistributedMember()); | ||
} finally { | ||
System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "enabledManagement"); |
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.
Is it correct to leave this System variable set after the test completes?
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.
@rhoughton-pivot Adding RestoreSystemProperties JUnit Rule restores all System Properties after each test.
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.catchThrowable; |
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.
What's the motivation behind using AssertJ instead of JUnit? How do we decide whether to use one vs the other?
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.
AssertJ is a much richer assertion API that introduced to Geode a few years ago. I highly recommend using it over JUnit assertions!
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.
@aaronlindsey: I think the general preference and consensus is to use AssertJ
instead of JUnit
, it's been discussed some time ago in the Geode dev list: https://markmail.org/message/al3st2gko4hddwo2.
Review is closed. I'm going to do one final rebase on develop, force-push to remove the empty commit (for precheckin trigger). and then merge to develop. |
VirtualMachine class can be loaded even if AttachProvider service providers are not found. This change forces loading of providers for isAttachAPIFound. Co-authored-by: Michael Oleske <moleske@pivotal.io>
…tegrationTest The tests that were using InetAddress.getLostHost for assertions may fail depending on /etc/hosts configuration. This change should prevent these failures. Co-authored-by: Michael Oleske <moleske@pivotal.io> Co-authored-by: Mark Hanson <mhanson@pivotal.io>
* Fixup IDE warnings * Reformat test code * Use SocketCreator.getLocalHost
* Fixup IDE warnings * Reformat test code
* Fixup IDE warnings * Reformat test code * Update to use AssertJ
40934ab
to
c566cd7
Compare
Co-authored-by: Michael Oleske moleske@pivotal.io
Co-authored-by: Mark Hanson mhanson@pivotal.io
Fixed StressNewTest job for all launcher tests. These were failing in StressNewTest. I also moved all files to TemporaryFolder.
Additional reviewers: @demery-pivotal @mhansonp @moleske @aaronlindsey
Note: due to the empty commit to trigger precheckin, I will do a rebase and force push after reviews but before the final merge to develop.