Is there any guide or example package demonstrating how to run tests of APIs within packages built using Plumber? I tried following the example package here: GitHub - sol-eng/plumbpkg: Example R package that includes Plumber APIs but I am having issues which I do not understand how to debug, there is not much information on testing on the official docs. If anyone has any tips, I'd appreciate it, thanks.
The port might already be in use on the machine. Maybe define port using port <- plumber:::findPort() which will return an available port. Build your test around that.
Hi @meztez, I figured out the issue and pulled it into the repo. Thanks for taking a look at this.
The issue was that the port that was being set was not actually being passed to the API getting set up inside of the callr process. So the problem has nothing to do with plumber, just the way the scoping in callr works, I guess it didn't find the variable. The port variable is now passed as an argument to the function evaluated in the callr function, and all tests work as expected now, locally and on GitHub Actions.