-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Improve test and build time by using -i flag #4758
Conversation
3a41172
to
8cf1cc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WFG
Curious to see if this also speeds up tests on Jenkins as libbeat packages are only built once for all beats. On Travis it probably doesn't make a difference as it is a new environment each time. |
Strangely the Jenkins build took longer them previous builds. |
I just reliased this does not apply when running the |
See elastic#4755 for details.
8cf1cc3
to
c32c53c
Compare
@@ -142,15 +143,18 @@ prepare-tests: | |||
.PHONY: unit-tests | |||
unit-tests: ## @testing Runs the unit tests with coverage. Race is not enabled for unit tests because tests run much slower. | |||
unit-tests: prepare-tests | |||
go test -i ${GOPACKAGES} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the help of go test
:
-i
Install packages that are dependencies of the test.
Do not run the test.
And indeed go test -i
doesn't actually run the tests. However, in master make unit-tests
seems to work fine, so I'm not quite sure what's going on. But this makes me think adding -i
to the test commands might not do what we expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually always run go test -i
followed by go test
. Just in the case here it is in the line below. Also see line 151 as an example. My tests showed that running go test -i
followed by go test
takes the same time together as just running go test
alone. So why do it? If you run it more then once, go test -i
is very quick and the run time will be much shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, I missed that we run the go test
without -i
afterwards. Thanks!
Will you merge this improvement to the 5.x branches? it is a very nice improvement. |
@cyrilleverrier No plan to backport this as it's not directly a feature. I would also give this some more time to be tested. I kind of still worry about side effects as there must be a reason this is not enabled in Golang by default. |
See #4755 for details.