Skip to content

KAFKA-3615: Exclude test jars in kafka-run-class.sh#1263

Closed
Ishiihara wants to merge 6 commits into
apache:trunkfrom
Ishiihara:classpath-no-test-jar
Closed

KAFKA-3615: Exclude test jars in kafka-run-class.sh#1263
Ishiihara wants to merge 6 commits into
apache:trunkfrom
Ishiihara:classpath-no-test-jar

Conversation

@Ishiihara
Copy link
Copy Markdown
Contributor

@granders @hachikuji Can you take a look when you have time? Appreciate your time to review.

Comment thread bin/kafka-run-class.sh Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems a bit too broad, can we not make the check a bit stricter?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are other files included too. Basically anything that gets built into */build/libs/* will show up be matched.

We should be sure to exclude javadoc, scaladoc, sources, test and test-sources jars.

@granthenke
Copy link
Copy Markdown
Member

@Ishiihara Just want to confirm that this is only an issue when running from source right? When running from a release the only line that loads jars in kafka-run-class.sh is the following:

# classpath addition for release
CLASSPATH=$CLASSPATH:$base_dir/libs/*

It shouldn't stop this change but I would love to have kafka-run-class.sh work the same for both source builds and release builds. If not done here I can open a jira to track that.

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@ijuma @granthenke Thanks for the review. I updated the patch to have more specific filtering condition and also make sure that we also filter files in case that we run from binary package.

@ewencp
Copy link
Copy Markdown
Contributor

ewencp commented Apr 28, 2016

@Ishiihara In build.gradle we have a task called systemTestLibs that depends on some test jars. I think that might be because we have some tests that execute code that's in the test jars. I think @granders set that up so maybe he can clarify how that's used. My concern is that filtering out all the test jars might break some of those tests. If we need support for running some classes in test jars then we might need to make it possible to toggle this filtering on/off (though filtering out by default seems like a good choice).

@granders
Copy link
Copy Markdown
Contributor

@Ishiihara @ewencp
Yeah I have the same concern - this may break a few tests which depend on classes in the test jar - e.g. the stream smoke tests.

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Apr 28, 2016

systemTestLibs was originally added because we need minikdc for the system tests. And then streams also started using this (as @granders said). It seems to me that we should have a variable that needs to be set for the test jars to be included. It is unexpected to have that as the default behaviour in my opinion.

@granders
Copy link
Copy Markdown
Contributor

An environmental variable to trigger addition of test jars seems reasonable

@ewencp
Copy link
Copy Markdown
Contributor

ewencp commented Apr 28, 2016

@ijuma @granders Agreed on the default behavior.

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@ewencp @ijuma @granders Thanks for the review, I would add an environment variable to control test jar addition.

@Ishiihara Ishiihara force-pushed the classpath-no-test-jar branch from a2fe7c9 to 27e3892 Compare April 28, 2016 19:52
@Ishiihara
Copy link
Copy Markdown
Contributor Author

Thanks for the review. Added a INCLUDE_TEST_JARS variable and change filter_file to should_include_file according to @granders suggestion.

@ewencp
Copy link
Copy Markdown
Contributor

ewencp commented Apr 28, 2016

@Ishiihara but presumably this flag needs to be enabled in some of the system tests?

@granders
Copy link
Copy Markdown
Contributor

granders commented Apr 28, 2016

@Ishiihara Offhand, I think Minikdc service and streams-related services will need this flag (in system test code)

And then it would probably be good to run in a branch builder

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@granders Added include test jars to relevant system test services.

Comment thread bin/kafka-run-class.sh Outdated
done
shopt -u nullglob

echo $CLASSPATH
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Leftover debug output

@ewencp
Copy link
Copy Markdown
Contributor

ewencp commented Apr 29, 2016

This LGTM, I'll just remove that one extra echo during commit

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@ewencp Thanks for the review, removed the left over debug output.

@asfgit asfgit closed this in eb50d2f Apr 29, 2016
Comment thread bin/kafka-run-class.sh

# classpath addition for release
CLASSPATH=$CLASSPATH:$base_dir/libs/*
for file in $base_dir/libs;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is broken. It should be for file in $base_dir/libs/*; ... without the glob, you're looping over 1 entry: "libs".

I believe this bug breaks the classpath for all scripts in bin/ in the release artifact

@Ishiihara Ishiihara deleted the classpath-no-test-jar branch May 9, 2016 23:08
gfodor pushed a commit to AltspaceVR/kafka that referenced this pull request Jun 3, 2016
granders hachikuji Can you take a look when you have time? Appreciate your time to review.

Author: Liquan Pei <liquanpei@gmail.com>

Reviewers: Grant Henke <granthenke@gmail.com>, Geoff Anderson <geoff@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes apache#1263 from Ishiihara/classpath-no-test-jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants