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

Fix "make fv" target from incorrectly running UTs. Also remove #2726

Merged
merged 2 commits into from
Jul 17, 2023

Conversation

Josh-Tigera
Copy link
Contributor

non-existent "vendor" directory skipPackage directive.

Description

This will speed up CI since it will remove the duplicate tests when "make ut" and "make fv" are run as separate jobs

For PR author

- [ ] Tests for change.
- [ ] If changing pkg/apis/, run make gen-files
- [ ] If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

non-existent "vendor" directory skipPackage directive.
@Brian-McM
Copy link
Contributor

It's probably fine to remove the vendor package, but I don't think it hurts to leave it in. There could always be a case where we have to re introduce vendoring go dependencies in the future, and if that happened then this command will blow up.

Makefile Outdated

## Run the functional tests
fv: cluster-create run-fvs cluster-destroy
run-fvs:
-mkdir -p .go-pkg-cache report
$(CONTAINERIZED) $(CALICO_BUILD) sh -c '$(GIT_CONFIG_SSH) \
ginkgo -pkgdir test -r --skipPackage ./vendor -focus="$(GINKGO_FOCUS)" $(GINKGO_ARGS) "$(WHAT)"'
ginkgo -r --skipPackage "./pkg" -focus="$(GINKGO_FOCUS)" $(GINKGO_ARGS) "$(WHAT)"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why pkgdir wasn't working? It should have forced only the packages in the test directory to load, as per this description:

  -pkgdir string
    	install and load all packages from the given dir instead of the usual locations.

We have code in other folder locations than just pkg and there's no reason we could have tests there, so I think an explicit "inclusion" of the directories where the fvs are located would probably be better if that can be achieved.

I notice that --skipPackage is used and not -skipPackage, could it be that we need to specify --pkgdir instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspected -pkgdir was being overridden by -r:
-r Find and run test suites under the current directory recursively.

I agree that an explicit inclusion strategy is better so I could change each UT/FV command to explicitly point at the appropriate directory. This would remove any risk with re-introduced vendor code as well. Something like:

Suggested change
ginkgo -r --skipPackage "./pkg" -focus="$(GINKGO_FOCUS)" $(GINKGO_ARGS) "$(WHAT)"'
UT_DIR?="./pkg"
FV_DIR?="./test"
ut:
ginkgo -focus="$(GINKGO_FOCUS)" $(GINKGO_ARGS) "$(UT_DIR)"'
run-fvs:
ginkgo -focus="$(GINKGO_FOCUS)" $(GINKGO_ARGS) "$(FV_DIR)"'

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's weird that the recursive flag would override the pkgdir, you'd think they'd work together (obviously the author thought that).

I just tried what you suggested and that looks good, I wonder why we were trying to use the pkgdir flag instead of just adding the directory as you've done...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the changes as discussed and CI passing with newly expected FV time of only a few minutes.

…s instead of filtering out unwanted directories
@Brian-McM Brian-McM merged commit 3c9fd64 into tigera:master Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants