Skip to content

Conversation

@Megamiun
Copy link
Contributor

@Megamiun Megamiun commented Nov 4, 2018

Relates to #34459

@alpar-t
Copy link
Contributor

alpar-t commented Nov 5, 2018

@elasticmachine test this please

@alpar-t alpar-t self-requested a review November 5, 2018 11:58
@cbuescher cbuescher added >enhancement :Delivery/Build Build or test infrastructure labels Nov 5, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

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.

Thansk for your contribution @Megamiun .
I left some comments. Still have to look at the tests.
Perhaps would be good to add a testkit based test to make sure that the up-to-date checks work as they should. Calling the task twice should result in the second time being up-to-date

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should expose this differently, but that can go into a separate PR.
Assigning this from configurations makes it way too easy to resolve the configurations too early.
We should get the dependencies on project like it's being assigned in BuildPlugin and offer ways to filter them, like having a List<Predicate> for projects that need it, like server/build.gradle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't do this one yet, think I will leave it to another future PR

@Megamiun Megamiun force-pushed the refactor/updateshastask-to-java branch from 5c4f895 to 3c116a9 Compare November 7, 2018 03:35
@Megamiun
Copy link
Contributor Author

Megamiun commented Nov 7, 2018

About the test-kit tests, I don't understand corretcly what should I do. Just a test to see if the status would be UP-TO-DATE on a repeated run?

@alpar-t
Copy link
Contributor

alpar-t commented Nov 7, 2018

You can look at tests that implement GradleIntegrationTestCase for some examples.
You have to set up a project that applies the build plugin and check that the tasks do what it's expected of them. Then run it a second time and assert that it's up to date. This will catch incorrectly wired task inputs for the most part. You could also change some of the inputs or outputs and validate that it's not considered up to date.

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Nov 7, 2018

@Megamiun you'll have to merge master to get the builds passing.

@Megamiun
Copy link
Contributor Author

Sorry for the delay, almost finished here.

But I saw something, it seems this task can not be used as up-to-date. I put it to run with --info and received:

Task ':x-pack:plugin:ml:dependencyLicenses' is not up-to-date because:
  Task has not declared any outputs despite executing actions.

It seems that by not existing output, gradle doesn't skip execution because of up-to-date status.

Probably by tomorrow I can make the MR

@tomcallahan
Copy link
Contributor

@Megamiun are you still interested in pursuing this PR ?

@Megamiun
Copy link
Contributor Author

Yes, thanks for remembering me, will try to do this weekend.

But even so, @atorok, about the UP-TO-DATE, is it really the desired behaviour?

@rjernst
Copy link
Member

rjernst commented Jan 25, 2019

about the UP-TO-DATE, is it really the desired behaviour?

Nope, we should fix this (although it doesn't have to be in this PR). The way we have done this in other cases is to use a "marker" file that we simply touch when the task completes, and configure that as the task output. For example, see ForbiddenPatternsTask.

@Megamiun Megamiun force-pushed the refactor/updateshastask-to-java branch from 3c116a9 to 5b119c9 Compare March 4, 2019 21:37
@Megamiun Megamiun force-pushed the refactor/updateshastask-to-java branch from 5b119c9 to 90add72 Compare March 5, 2019 05:56
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.

@elasticmachine test this please

compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"


compile "commons-codec:commons-codec:${props.getProperty('commonscodec')}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we adding this would try to avoid increasing the transitive dependencies if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this to add the possibility of encoding the sha1 byte array to an hex string.

It seems the way to do it is a little more laborious in pure java and the encodeHex method was a Groovy method.

If prefered, I can change the impl to use java directly.

And when making changes, I just need to rebase my branch, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, and the integTest task takes some hours(it didn't complete yet), on my computer, is it normal?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Megamiun thanks for the explanation, I think that's good enough reason to add it.
Unfortunately our integ tests do take that long currently, there's many of them and we are working to optimize execution to make them faster.

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 7, 2019

@elasticmachine tesdt this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 7, 2019

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Mar 7, 2019

@elasticmachine test this please

@Megamiun
Copy link
Contributor Author

Megamiun commented Mar 8, 2019

Hello, tried to resolve the IT tests problem, is it possible to run again the tests? Unfortunately the time it takes to tuns the tests makes it not possible to test it on my pc

@alpar-t
Copy link
Contributor

alpar-t commented Mar 8, 2019

@Megamiun you can run the test you added alone with this command: ./gradlew :build-tools:integTest --tests="*DependencyLicensesTasksIT"

@elasticmachine test this please

@Megamiun
Copy link
Contributor Author

Megamiun commented Mar 9, 2019

I think maybe there is a problem with my pc, it has been eleven hours and the integtests are still running. And I used the command to run only mine.

I analysed the jarHell its and I tried to make some changes that to me seems to resolve the problem

@Megamiun
Copy link
Contributor Author

Megamiun commented Mar 19, 2019

Hello, @atorok?

GradleRunner runner = getRunner("dependencies_missing");

assertTaskFailed(runner.build(), ":dependencies_missing:dependencyLicenses");
assertTaskFailed(runner.buildAndFail(), ":dependencies_missing:dependencyLicenses");
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is needed, but when asserting for failure we should assert for something in the output to make sure we are getting the failure we want.
I can see that from the last test run we got Plugin with id 'elasticsearch.build' not found. so I don't think we are getting the intended failure here yet the test would pass.

The reason for the failure is that you must use the new Gradle syntax to apply the plugin. take a look at buildSrc/src/testKit/elasticsearch.build/build.gradle

@Megamiun Megamiun closed this May 6, 2019
@Megamiun Megamiun deleted the refactor/updateshastask-to-java branch May 6, 2019 21:25
@Megamiun Megamiun restored the refactor/updateshastask-to-java branch May 6, 2019 21:28
@Megamiun
Copy link
Contributor Author

Megamiun commented May 6, 2019

Sorry, @atorok, I closed this PR by error. Now I am doing one more try of running the tests. I will open a new PR once I finish this.

I found a way to run the integTests locally

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 >enhancement Team:Delivery Meta label for Delivery team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants