Open elee1766 opened 1 week ago
* The blast radius of breakage is unfortunate. There are at least 5 users of the `caddytest` package, which this break all of them. I believe it's possible to avoid the breaking changes, at least by swapping the struct's names and re-adjusting their responsibilities.
I think that the PR should irrevocably break the caddytest package, change the API to something that is better, and force the 5-10 downstream users of caddytest to rewrite. If these usages of caddytest are important, then I will personally rewrite or help to rewrite such tests with the new api in preparation for the merge of this PR.
Alternatively, I can construct a compatibility package (caddytestcompat) that can be marked deprecated that these downstream consumers can consciously chose to not migrate and use the old api.
I am still unhappy with both the Tester
and TestHarness
api, and the changes i have made so far are simply a proof of concept to make sure that the new caddy instance once a file would work. I think more breaking changes need will need to happen. I refuse to succumb to sunk cost in this case, and this amount of usages i do not think is wide spread at all.
Yeah, I am not too worried about breakage at this point, since these are just test APIs, and we've never really formalized them or intended them to be used much. I'm hoping these new changes will be more permanent, more flexible, more useful to plugin authors, etc, that we can proudly document and demonstrate.
Thanks for working on this! I have a big backlog but will hope to join the reviews at some point soon. Don't let me hold things back though.
Change caddytest to allow running one instance of caddy per test
caddytest works checking if there is an admin api mounted, and if it is mounted, calls /load on the api, and tries to run tests. If it is not mounted, it tries to start caddy.
this introduced the following race conditions when running
go test ./...
os.Args
, but also both execute the not-protectedrootCmd
at the same time, and one will eventually fail, as only one server may bind 2999.In order to remedy this, some somewhat large changes need to be made.