-
Notifications
You must be signed in to change notification settings - Fork 738
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
Tests for isAccessUserOnly0 native #1656
Conversation
} | ||
|
||
FileSystem fs = FileSystem.open(); | ||
File file = new File("test-file-name"); |
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.
@smlambert concerns with this file created for testing? I've made sure to delete it at the end of each test.
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.
Creating a file is not an issue (as you clean it up after). There are some other test changes that we will ask for on this PR, I've added @llxia for a review.
c2fe526
to
da3f76c
Compare
test/Java8andUp/playlist.xml
Outdated
@@ -1843,5 +1843,46 @@ | |||
<subset>SE90</subset> | |||
</subsets> | |||
</test> | |||
|
|||
<test> | |||
<testCaseName>FileSystem-isAccessUserOnlyTests_SE90</testCaseName> |
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.
For tests that should apply to Java9 and Up, its preferred to call the Java8 tests _SE80, and then drop the suffix, so the same test can be used for 9, 10, 11 and so on.
*******************************************************************************/ | ||
|
||
import org.testng.annotations.Test; | ||
import org.testng.AssertJUnit; |
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.
For brand new test code, you could just import org.testng.Assert; and we should update the example, so that it uses it to. Some tests use AssertJUnit because they were converted using a JUnit-to-TestNG plugin, and the ordering of the arguments for JUnit asserts are reversed from the order of TestNG asserts.
I have not done a diff between your Test_FileSystem.java code for src_80, src_90_latest, and src_90_current, but seems like a good opportunity to reuse some code (see examples of reuse). Another question, perhaps for @DanHeidinga, is it necessary to add tests for src_90_current, does this refer to b148 class libraries, and when can we stop adding tests to continue to support that JCL version)? |
@theresa-m Have you seen some of the createTempFile api calls like: https://docs.oracle.com/javase/9/docs/api/java/io/File.html#createTempFile-java.lang.String-java.lang.String-java.io.File- Using those calls avoids having to name the file and ensures that the tests can be run in parallel as the file(s) will be unique. The code explicitly deleting the file is good and to cover all the cases, please also call https://docs.oracle.com/javase/9/docs/api/java/io/File.html#deleteOnExit-- on the files. |
We should not be adding new tests to support b148. That's an IBM-ism |
test/Java8andUp/playlist.xml
Outdated
<group>functional</group> | ||
</groups> | ||
<subsets> | ||
<subset>SE90</subset> |
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.
also, if the test applies to Java9 and Up, then please add subset
<subset>SE100</subset>
<subset>SE110</subset>
If you debase your branch, you will see tests in this playlist.xml is updated to have SE100 and SE110.
Yes reusing code for this will be great. The files are exactly the same except for the package name of the class they are testing. Thanks for the link @smlambert |
The addition of the current/latest folders for Java 9 was mainly because of internal test compile failures. The FileSystem class being tested changed locations between jcl versions so my test would not work on both jcls. Are there some better ways this could work? |
da3f76c
to
bb11904
Compare
Ready for another review. |
test/Java8andUp/build.xml
Outdated
</classpath> | ||
</javac> | ||
</else> | ||
</if> |
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.
Instead of using if else, could we use variables to avoid code duplication? The differences between if and else are the following:
${src_90_current}
and${src_90_latest}
--add-exports java.management/sun.management=ALL-UNNAMED
and--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED
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.
good idea. I just pushed this update
bb11904
to
424b1f7
Compare
Jenkins test sanity plinux jdk9,jdk10 |
Marking as WIP so this does not get merged before #1655 |
Aborted both test builds as they will not pass without #1655 |
98661b1
to
5ab7fcf
Compare
@llxia the dependencies for this pr have been merged |
rebasing as this is a while behind. |
Jenkins test sanity plinux jdk9,jdk10 edit: looks like I don't have permission to do this :) |
Jenkins test sanity plinux jdk9,jdk10 |
Jenkins test sanity plinux jdk8 |
Jdk10 test failure is fixed pending #1942 |
jenkins test sanity plinux jdk10 |
@llxia @smlambert ready for another look |
|
||
protected void resolveTest(boolean actualResult, boolean expectedResult) { | ||
logger.debug("Test passed: " + (expectedResult == actualResult)); | ||
Assert.assertEquals(expectedResult, actualResult); |
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.
Do we need logger.debug("Test passed: " + (expectedResult == actualResult))
? Does Assert.assertEquals(expectedResult, actualResult)
provide the same information?
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.
its not very helpful. I will take that out.
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 rest looks good to me.
- includes tests for isAccessUserOnly0 in Java8 and Java9 - expanded test infra to have src_90_current and src_90_latest files for different JCL versions in Java 9 Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
updated with Lan's latest comment |
@pshipton this is ready to go |
Relies on: #1655
Signed-off-by: Theresa Mammarella Theresa.T.Mammarella@ibm.com