-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Automatically bootstrap ginkgo as a part of generate target #359
Conversation
Can one of the admins verify this patch? |
504bfea
to
0e81c21
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.
Just a couple questions. Thanks!
Makefile
Outdated
@@ -8,6 +8,7 @@ generate: | |||
find pkg/ -name "*generated*.go" -exec rm {} -f \; | |||
./hack/build-go.sh generate ${WHAT} | |||
goimports -w -local kubevirt.io cmd/ pkg/ tests/ | |||
./hack/bootstrap-ginkgo.sh test ${WHAT} |
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.
Make generate is being used for formatting and documentation. I don't personally like the idea of running the test suite at that point. We already have the make test
and make functest
targets. Isn't that enough?
EDIT: Or am I misreading this line because of the test
argument, which actually appears to be unused in hack/bootstrap-ginkgo.sh
?
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.
You've spotted an evil copy-paste. :)
It's only supposed to generate the structure, not run the tests. Will fix the tests.
pkg/healthz/healthz_suite_test.go
Outdated
"testing" | ||
) | ||
|
||
func TestHealthz(t *testing.T) { |
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.
It's not clear to me why these explicit test wrappers are needed. What do we gain?
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.
They're the minimal test files that ginkgo initializes. We don't gain a lot initially, but we won't forget to initialize ginkgo tests in the future.
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.
It is unclear why we need this change. Our test suite works as it is now. What is being improved with this?
The objective is not really improving the current suite, but making sure if/when new packages are added or current packages are split, we don't forget to bootstrap ginkgo within them (otherwise, they'll be left out of testing). Ran into the issue myself in previous PR, would prefer to have it done automatically. |
@rmohr this is probably something you should weigh in on. |
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.
Other than the spurious test
argument (which isn't a big deal), this PR LGTM. I personally am a huge fan of having automatic tools remember petty details for devs. Would still like others to weigh in as there seems to be some questions surrounding this.
0e81c21
to
d712048
Compare
Pushed the arg removal, the decision is up to you all. Also note that the generation isn't perfect - it would be nice to have some kind of go package introspection to really only call it in directories where it's needed. |
While I would prefer, that the suits are only added, if there is a tests file which needs it, or there would be some kind of check which makes travis fail, I like that it eliminates the mentioned errors. I also found some disabled tests a few days ago, because accidentally such a suit file was removed. |
ok to test |
OK to test |
testing this again. |
@mpolednik could you rebase? Sorry for letting that hang so long in approved state. |
hack/bootstrap-ginkgo.sh
Outdated
if [ "x${GOFILES}" != "x0" ]; then | ||
# Since ginkgo bootstrap doesn't take path, we have to hop in the | ||
# target package first. | ||
(cd $dir && ginkgo bootstrap || :) |
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.
What came to my mind: How about checking here, if a "*_test.go" file exists in the directory, and only then do the bootstrap?
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.
Yeah, that could work. Gonna look into it along the rebase ASAP.
e1e26fe
to
01e14a1
Compare
Ginkgo tests require each tested package to be bootstrapped to run. This patch makes the bootstrapping available in makefile's generate target (which is safe automatically in commit hook). The nature of this approach causes multiple new files - these indicate packages that were not really tested by ginkgo. On the other hand, when adding tests for those packages, we are not required to bootstrap them anymore. Signed-off-by: Martin Polednik <mpolednik@redhat.com>
01e14a1
to
9a532de
Compare
retest this please |
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.
The one flaky test fails again on CI. Non-related
libcni, pkg\invoke: Use OS-specific list separator when parsing CNI_PATH
Ginkgo tests require each tested package to be bootstrapped to run.
This patch makes the bootstrapping available in makefile's generate
target (which is safe automatically in commit hook).
The nature of this approach causes multiple new files - these indicate
packages that were not really tested by ginkgo. On the other hand,
when adding tests for those packages, we are not required to bootstrap
them anymore.
Signed-off-by: Martin Polednik mpolednik@redhat.com