Skip to content

Conversation

@alpar-t
Copy link
Contributor

@alpar-t alpar-t commented Nov 23, 2018

This is in the context of #33524 and #34820 and an annoyance I had with running these checks as a separate process.

This PR introduces a new task meant to replace NamingConventionsCheck and NamingConventionsTask.
In the interest of keeping the PR small it does not do so yet, but the goal is to have all the checks implemented here.
These checks will be added as follow ups and we will eventually replace the old tasks with the new porting the existing tests to the new task.

There are small changes in the way the checks are done, like looking for method naming connections and methods annotated with @Test.

The advantage of doing this in Gradle is speed and the ability to gather insights.
This will allow us to do things like auto disable testing tasks if all tests are muted.

We call the same reflection methods multiple times, like getting the methods of a class multiple times to keep what's being checked for more readable.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 26, 2018

@elasticmachine run gradle tests 1

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 26, 2018

@elasticmachine run gradle build tests 1

1 similar comment
@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 26, 2018

@elasticmachine run gradle build tests 1

@alpar-t alpar-t force-pushed the testing-conventions-task branch from 5e64218 to 3a80432 Compare November 26, 2018 20:55
Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

I like it! I left a minor thing. We can build on this and remove the other checks that we have as we go! wonderful.

private static final String TEST_CLASS_SUFIX = "Tests";
private static final String INTEG_TEST_CLASS_SUFIX = "IT";
private static final String TEST_METHOD_PREFIX = "test";
private final List<String> problems;
Copy link
Member

Choose a reason for hiding this comment

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

It feels like this should be a method variable in the test() method.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

One question. I'm also curious how long this takes vs the previous task testing conventions implementation?

public abstract class Boilerplate {

public static SourceSetContainer getJavaSourceSets(Project project) {
return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets();
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need to be in a separate class?

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 just updated the FilePermissionsTask to use it too. I suspect there are others too, and there are possibly other cases where something that's straight forward in Groovy is lengthy in java. I wanted to create a home for these.

Copy link
Member

Choose a reason for hiding this comment

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

The name is a bit funny to me but I understand why you'd want something for this.

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 29, 2018

@rjernst namingConventions runs in 1m 5s for me testingConventions completes in 55s ( both are following a clean )

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 29, 2018

@elasticmachine run gradle build tests 1

@nik9000
Copy link
Member

nik9000 commented Nov 29, 2018

@rjernst namingConventions runs in 1m 5s for me testingConventions completes in 55s ( both are following a clean )

Is that including compile or just the running the task? Does it include gradle's startup time? Or is it the runtime of running that task for all subprojects?

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

I'm happy with it modulo the timing discussion.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM. I also think after we convert the existing namingConventions uses, we should change this task name back to namingConventions

@alpar-t
Copy link
Contributor Author

alpar-t commented Nov 30, 2018

The times are what Gradle reports after running each task after a clean has previously been ran, using the daemon and parallel. So it does include compile times as well.

@alpar-t alpar-t merged commit d128b38 into elastic:master Nov 30, 2018
@alpar-t alpar-t deleted the testing-conventions-task branch November 30, 2018 07:35
alpar-t added a commit that referenced this pull request Nov 30, 2018
@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 >non-issue Team:Delivery Meta label for Delivery team v6.6.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants