Skip to content

convert EmptyDirTask.groovy to .java #34672

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

Merged
merged 15 commits into from
Jun 13, 2019
Merged

convert EmptyDirTask.groovy to .java #34672

merged 15 commits into from
Jun 13, 2019

Conversation

vboulaye
Copy link
Contributor

related to #34459, convert the EmptyDirTask.groovy to java
I tried to follow the instructions in the issue notes and the related FileContentsTask PR, but I am still new to this...

@jasontedor jasontedor requested review from alpar-t and rjernst October 21, 2018 20:00
@jasontedor jasontedor added the :Delivery/Build Build or test infrastructure label Oct 21, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jasontedor
Copy link
Member

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Oct 22, 2018

@vboulaye looks like CI picked up on some inconsistent naming.
You can pick these up without waiting for CI with: ./gradlew precommit --parallel.

23:15:48 Not all subclasses of GradleUnitTestCase match the naming convention. Concrete classes must end with [Tests]:
23:15:48  * org.elasticsearch.gradle.EmptyDirTaskTest

@alpar-t
Copy link
Contributor

alpar-t commented Oct 22, 2018

@elasticmachine test this please

Copy link
Contributor

@alpar-t alpar-t left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @vboulaye I left a few small comments.

@alpar-t
Copy link
Contributor

alpar-t commented Oct 23, 2018

@elasticmachine test this please

1 similar comment
@alpar-t
Copy link
Contributor

alpar-t commented Oct 24, 2018

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Nov 16, 2018

@elasticmachine test this please

1 similar comment
@danielmitterdorfer
Copy link
Member

@elasticmachine test this please

@danielmitterdorfer
Copy link
Member

I have merged the latest master into the fork as the PR CI build has failed due to the outdated branch.

@danielmitterdorfer
Copy link
Member

@elasticmachine test this please

@danielmitterdorfer
Copy link
Member

@elasticmachine run elasticsearch-ci/default-distro

1 similar comment
@danielmitterdorfer
Copy link
Member

@elasticmachine run elasticsearch-ci/default-distro

@alpar-t
Copy link
Contributor

alpar-t commented Jan 30, 2019

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 19, 2019

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 19, 2019

@vboulaye can you look at these test failures please

08:37:08 
08:37:08 Suite: org.elasticsearch.gradle.EmptyDirTaskTests
08:37:08 ERROR   0.04s J3 | EmptyDirTaskTests.testCreateEmptyDirNoPermissions <<< FAILURES!
08:37:08    > Throwable #1: java.io.IOException: No such file or directory
08:37:08    > 	at __randomizedtesting.SeedInfo.seed([6F817AD5CAEDB71F:F41C0C60338EE88]:0)
08:37:08    > 	at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
08:37:08    > 	at java.base/java.io.File.createTempFile(File.java:2090)
08:37:08 ERROR   0.02s J3 | EmptyDirTaskTests.testCreateEmptyDir <<< FAILURES!
08:37:08    > Throwable #1: java.io.IOException: No such file or directory
08:37:08    > 	at __randomizedtesting.SeedInfo.seed([6F817AD5CAEDB71F:A6092EB73A3AD97F]:0)
08:37:08    > 	at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
08:37:08    > 	at java.base/java.io.File.createTempFile(File.java:2090)
08:37:08 Completed [2/8] on J3 in 0.12s, 2 tests, 2 errors <<< FAILURES!

@vboulaye
Copy link
Contributor Author

Hi, I'll have a look at what is broken now.

@vboulaye
Copy link
Contributor Author

I tried to reproduce the error but I do not see how to do that:
The failure was apparently thrown by the RandomizedTestingTask which somehow prevented the TemporaryFolder @rule to create the temp directory build in the setup for the tests.

I tried to reproduce the issue by setting the same seed on the command line:

./gradlew :build-tools:unitTest -Dtests.seed="6F817AD5CAEDB71F:A6092EB73A3AD97F" -Dtests.class=org.elasticsearch.gradle.EmptyDirTaskTests 

But the tests are passing.

I also tried adding @Seed with the 2 seeds on the class/method level. But the test are passing too.

There is another test using TemporaryFolder;; BuildExamplePluginsIT

How can I reproduce the issue ?
Or how should I proceed to build a temp directory for my tests ?

@alpar-t
Copy link
Contributor

alpar-t commented Mar 21, 2019

@vboulaye thanks for looking at the failure. I have seen an incompatibility between randomized testing and rules to create temp folders before, but didn't pursue it at the time,
because the rule is not necessary in most cases in these tests, that's also the case with your test, no need to pass that in the gradle test project tooling takes care of that for you, just don't pass a directory.

@vboulaye
Copy link
Contributor Author

Hi,
I removed the use of TemporaryFolder by reusing the project build directory to create my test folder manually.
Will this work ?

@vboulaye
Copy link
Contributor Author

My gradle check failed again...

Suite: org.elasticsearch.gradle.EmptyDirTaskTests
ERROR   0.01s J3 | EmptyDirTaskTests.testCreateEmptyDirNoPermissions <<< FAILURES!
   > Throwable #1: java.io.IOException: No such file or directory
   >    at __randomizedtesting.SeedInfo.seed([A83400AACDDF4B1E:C8F4BAB9040A1289]:0)
   >    at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
   >    at java.base/java.io.File.createTempFile(File.java:2090)
   >    at org.elasticsearch.gradle.EmptyDirTaskTests.getNewNonExistingTempFolderFile(EmptyDirTaskTests.java:73)
   >    at org.elasticsearch.gradle.EmptyDirTaskTests.testCreateEmptyDirNoPermissions(EmptyDirTaskTests.java:57)
   >    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   >    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   >    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   >    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
ERROR   0.01s J3 | EmptyDirTaskTests.testCreateEmptyDir <<< FAILURES!
   > Throwable #1: java.io.IOException: No such file or directory
   >    at __randomizedtesting.SeedInfo.seed([A83400AACDDF4B1E:61BC54C83D08257E]:0)
   >    at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
   >    at java.base/java.io.File.createTempFile(File.java:2090)
   >    at org.elasticsearch.gradle.EmptyDirTaskTests.getNewNonExistingTempFolderFile(EmptyDirTaskTests.java:73)
   >    at org.elasticsearch.gradle.EmptyDirTaskTests.testCreateEmptyDir(EmptyDirTaskTests.java:36)
   >    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   >    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   >    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   >    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

I'll have to look at it again.

return newEmptyFolder;
}

private Project createProject() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please inline this and the next method as they are now just one-liners.

@alpar-t
Copy link
Contributor

alpar-t commented Mar 21, 2019

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 22, 2019

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 25, 2019

@elaticmachine run elasticsearch-ci/packaging-sample , run elasticsearch-ci/default-distro and run elasticsearch-ci/bwc

@alpar-t
Copy link
Contributor

alpar-t commented Mar 25, 2019

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Jun 12, 2019

@elasticmachine update branch

1 similar comment
@alpar-t
Copy link
Contributor

alpar-t commented Jun 12, 2019

@elasticmachine update branch

@alpar-t
Copy link
Contributor

alpar-t commented Jun 12, 2019

@elasticmachine test this please

@alpar-t alpar-t merged commit de32917 into elastic:master Jun 13, 2019
alpar-t pushed a commit that referenced this pull request Jun 13, 2019
@alpar-t alpar-t added the v7.3.0 label Jun 17, 2019
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.3.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants