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

Automatically bootstrap ginkgo as a part of generate target #359

Merged
merged 1 commit into from
Sep 4, 2017

Conversation

mpolednik
Copy link
Contributor

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

@kubevirt-bot
Copy link
Contributor

Can one of the admins verify this patch?

@mpolednik mpolednik force-pushed the ginkgo-bootstrap branch 7 times, most recently from 504bfea to 0e81c21 Compare August 7, 2017 13:34
Copy link
Member

@stu-gott stu-gott left a 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}
Copy link
Member

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?

Copy link
Contributor Author

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.

"testing"
)

func TestHealthz(t *testing.T) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@davidvossel davidvossel left a 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?

@mpolednik
Copy link
Contributor Author

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.

@davidvossel
Copy link
Member

@rmohr this is probably something you should weigh in on.

Copy link
Member

@stu-gott stu-gott left a 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.

@mpolednik
Copy link
Contributor Author

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.

@rmohr
Copy link
Member

rmohr commented Aug 9, 2017

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.

@rmohr
Copy link
Member

rmohr commented Aug 9, 2017

ok to test

@fabiand
Copy link
Member

fabiand commented Aug 15, 2017

OK to test

@fabiand
Copy link
Member

fabiand commented Aug 15, 2017

testing this again.

@rmohr
Copy link
Member

rmohr commented Aug 31, 2017

@mpolednik could you rebase? Sorry for letting that hang so long in approved state.

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 || :)
Copy link
Member

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?

Copy link
Contributor Author

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.

@mpolednik mpolednik force-pushed the ginkgo-bootstrap branch 2 times, most recently from e1e26fe to 01e14a1 Compare September 4, 2017 10:28
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>
@rmohr
Copy link
Member

rmohr commented Sep 4, 2017

retest this please

Copy link
Member

@rmohr rmohr left a 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

@rmohr rmohr merged commit 7421326 into kubevirt:master Sep 4, 2017
mzzgaopeng pushed a commit to mzzgaopeng/kubevirt that referenced this pull request Mar 8, 2021
libcni, pkg\invoke: Use OS-specific list separator when parsing CNI_PATH
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.

None yet

6 participants