-
-
Notifications
You must be signed in to change notification settings - Fork 660
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
Crash when trying to upgrade to v2 #875
Comments
hey @KevinJCross - presumably updating all the dependencies to v2 will resolve this but I imagine there's complexity around that. I looked at I could imagine doing something ugly in Ginkgo (either v1 or v2) to sidestep flag initialization and avoid the panic. But. The reality is that you'd still be using two different major versions of Ginkgo - basically two completely different Go packages as far as Go is concerned. Those two major versions aren't going to be compatible. On the most basic level, they'll have different instances of the global suite object that Ginkgo uses to provide the DSL - but, deeper than that, the interfaces and implementations under the hood will have changed such that there are no guarantees that the two major versions can interoperate in this way. I'm afraid the cleanest (and most sustainable) way out of this is to work towards updating all the dependencies toward support Ginkgo v2. In the case of |
FWIW I'd be happy to try to help update a few dependencies - if you can point me at them I can spend some time submitting PRs |
Ok lets give it a go but I think Its not going to be a small task and will probably require some forks due to owner not being contactable any more. |
There are at least 5 in our deps using v1 in the project and who knows how many thay have too. |
Can you list out and share the five? i dare say that "this is the work" and it will be better to deal with it sooner rather than later. |
There are situations in which it does seem to work. One of my projects has:
And does not crash when testing. I'm not clear why it would work in one project and not another. Maybe the Go version or something makes a difference? |
I don't think it's the Go version. I think it has to do with how the dependency is used. @KevinJCross - things may not be quite as dire as they seem: If a dependency uses Ginkgo for it's own tests then it's fine for it to use a different major version of Ginkgo. The 1.x version will appear in The problem only appears if a dependency package (not it's magic test package, but the package itself) that is imported into your v2 tests uses Ginkgo v1. In the case above, Best I can tell, for the (Caveat: I think |
@onsi thanks for having a look ill look into this a bit more too. |
No, I think it's a bit different. Let me try again: (a) If an individual package imports both Ginkgo V2 and Ginkgo V1 (either directly or via some dependency) then 💥 |
ah, sorry, I think I misunderstood you:
you mean "if it's in the dependency and not in the *_test package it will cause problems". Yes that's what I mean. If it's in the dependency (specifically in a package you import into your test suite) it will cause problems. |
Maybe as a note of another potential source of 💥: I had an import for |
Thanks @thediveo - i'm adding an FAQ to the migration guide to capture some of this subtlety. @KevinJCross ive opened tedsuo/ifrit#35 and will work on it this week. |
I've updated the migration docs to capture this issue and give folks a bit more guidance. Adding that link here so others can find it and in case you'll find it helpful @KevinJCross Gonna work on Ifrit in the next few days so should have a PR for Ted to pull in soon. |
by "next few days" I guess I meant "now" |
Hi, we are from SAP, we are experiencing the same problem. is it merged? |
Nope it doesn't look like it's merged yet |
If you want to start using ginkgo v2 before all your dependencies have switched to v2, apply this workaround: go mod edit -replace github.com/onsi/ginkgo=github.com/phil9909/ginkgo@v1.16.6-0.20220211153547-67da0e38b07d
go mod tidy This renames the flags of ginkgo v1. This should not matter, if all your packages use ginkgo v2. |
Ive created a few forks for cf/pivotel related repo's to enable us to move the app-autoscaler-release to V2 |
- remove ginkgo v1 reference - remove deprecated ginkgo table import - replace GinkgoParallelNode with GinkgoParallelProcess - bump ginkgo v2 to latest v2.9 - fix an error "flag redefined ginkgo.seed". See more in onsi/ginkgo#875 (comment) Signed-off-by: Rui Yang <ruiya@vmware.com>
- remove ginkgo v1 reference - remove deprecated ginkgo table import - replace GinkgoParallelNode with GinkgoParallelProcess - bump ginkgo v2 to latest v2.9 - fix an error "flag redefined ginkgo.seed". See more in onsi/ginkgo#875 (comment) Signed-off-by: Rui Yang <ruiya@vmware.com> Signed-off-by: Konstantin Troshin <k.troshin@fme.de>
Hi guys,
Im currently trying to upgrade to v2 on our cloudfoundry app-autoscaler project and have hit a significant blocker.
The issue will probably in more complex projects with loads of dependencies that use ginkgo from multiple versions i.e. a transient dependency (because go does not have a test dependency tree)
I believe there are at least 4 dependencies transitily including the v1 ginkgo
This means in our project we have 1.16.5 and 2.0.0 included.
This does not work because of the init(){} functions in both included dependencies are run and they use the
flag.CommandLine at init time and modify it creating duplicate flags that causes panics with
After finding this I updated the v2 module to make a copy of the command line changing v2 to using a copy... this stops the panic
/v2/ginkgo/types/config.go:346
but the v1 reports:
flag provided but not defined: -ginkgo.randomize-all
somehow 😕I tried looking a bit further but it all gets a bit wierd with the 2nd layer of compliation 🤷
Ive also tried using the
in the go mod file but too no avail.
to replicate this error try checkout the autoscaler project https://github.com/cloudfoundry/app-autoscaler-release
checkout the branch
ginkgo-v2
and run
make test
this should replicate this issue easily (after a bunch of docker ect.)
The text was updated successfully, but these errors were encountered: