-
Notifications
You must be signed in to change notification settings - Fork 158
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
Unable to integrate pebble due to vendoring #227
Comments
👋 Hi @bluecmd - thanks for opening this issue.
That's interesting - it isn't how we've imagined Pebble being integrated into integration tests to date. Pebble isn't written to be consumed as a Go library. I suspect there will be many points of refactoring required (and the other issues you've been flagging give me the same sense). Did you consider running Pebble as an external process for your integration testing? I know this is clunky for a Go project but I think it will be an easier experience with the current codebase.
I'm on the fence about this. I don't have the cycles to drive the refactoring that would be needed to make Pebble easy to use as a Go library. Taking smaller patches that address one-off problems might be the wrong approach - its a fairly fundamental mismatch between how Pebble was written and how you're using it. @jsha What do you think? |
Hi! 👋 I 100% sympathize with you hesitating to add an API guarantee :-).
Yes, and it's something I'm trying to optimize away from in the integration test suite. Tracking the lifetime of external servers and making sure the state is cleaned up, as well as communicating through temporary files is sadly usually error prone and leads to flaky tests :-(. I explicitly chose Pebble because I'd rather keep up with a unstable API (since I vendor it it's not that big of a deal) than having to debug state across processes. It's certainly a bit awkward to call os.Setenv in the middle of a test case, but overall it works pretty well :-). If you want to see the usages with your own eyes, have a look at https://github.com/u-root/u-bmc/blob/master/pkg/bmc/cert/load_test.go and https://github.com/u-root/u-bmc/blob/master/integration/utils/acme.go - one is an unit integration test, and one is an end-to-end test (confusingly enough called "integration", but is more end-to-end). If I could chose an API freely, from the use cases I have now it would look like:
It's still a bit early here so I might edit this above if I remember something down the line :-) To re-iterate: I have no expectations that this will become a supported use of Pebble, I'll make do with the status quo. |
Hi @bluecmd, Welcome to the Pebble repo! Glad you're finding it useful for integration testing. I definitely think it's worth going through the hassle of spinning up and spinning down a separate process for Pebble. I know it's a hassle, but it produces a more realistic integration test. You're less likely to accidentally hide important behavior by virtue of being in the same process space. That said, I think your import error is actually solved in current Go vendoring, with or without modules. It's hard to say without seeing everything you're running, but my guess is that somewhere, something is imported using it's vendored path rather than it's real path. I would recommend grepping for "vendor" among your imports. I assume you're on a version of Go that handled vendoring by default? |
Well, we will have to agree to disagree then :-). When running the project in a simulator Pebble is run in stand alone mode, but when running the 10s of integration tests I'm trying really hard to not pollute state between the processes and having to parse output like when dynamically binding to any open port to allow concurrent tests to run. Anyway, for the vendoring issue. No, I'm sad to say that this is one of the things I find surprisingly bad about go. Stuff really quite breaks when you do what is currently done in Pebble - but it's fine, as everybody else is doing it. I guess today you more or less have to vendor.
Edit: Go version reports |
One thought: Pebble is using Pebble doesn't have any tests and it seems like carrying the Changing to an interface would mostly benefit the library use-case that we can't support and would also leave the dep so I think its a less compelling avenue. |
Yep, that works! |
Hi,
I'm trying to integrate Pebble in my integration test like this:
When compiling I get these errors:
I believe this is an unfortunate reality of Golang's current vendoring system. Maybe Go modules will solve it in the future - but for now that doesn't help me sadly :-).
Would you consider taking in Clock as an interface instead? Something like:
That should bypass the vendoring issue.
Thanks for your consideration,
The text was updated successfully, but these errors were encountered: