Skip to content
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

Exclude modules with init() in tests from includes lists #12650

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

jsoriano
Copy link
Member

Tool that collects modules for the includes lists checks only
include packages that have an init method, but it can also
include packages whose inits methods are defined only in
tests. Exclude these packages from the list.

This is required to do go tests in modules without code as
filebeat modules or metricbeat light modules (#12270).

@jsoriano jsoriano added module Team:Integrations Label for the Integrations team labels Jun 24, 2019
@jsoriano jsoriano requested a review from a team as a code owner June 24, 2019 15:21
@jsoriano jsoriano self-assigned this Jun 24, 2019
@jsoriano jsoriano mentioned this pull request Jun 24, 2019
3 tasks
@@ -33,7 +33,6 @@ import (
_ "github.com/elastic/beats/packetbeat/protos/nfs"
_ "github.com/elastic/beats/packetbeat/protos/pgsql"
_ "github.com/elastic/beats/packetbeat/protos/redis"
_ "github.com/elastic/beats/packetbeat/protos/tcp"
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this was doing nothing?

Copy link
Member Author

@jsoriano jsoriano Jun 24, 2019

Choose a reason for hiding this comment

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

Correct, it has an init on its tests.

if err != nil {
log.Fatal("Failed checking for .go files in package dir: %v", err)
}
if len(goFiles) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I think this was used as a sanity check with the assumption that anything using this code should find at least one thing to import. Maybe we should add this check after the for loop completes?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this check because at the end if there are no go files then foundInitMethod is never going to be true.

@jsoriano
Copy link
Member Author

jenkins, test this again please

@jsoriano jsoriano merged commit 7a6f8d5 into elastic:master Jun 25, 2019
@jsoriano jsoriano deleted the include-skip-test-inits branch June 25, 2019 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants