ddollar / foreman

Manage Procfile-based applications
http://ddollar.github.com/foreman
MIT License
6.01k stars 630 forks source link

[spec_helper.rb] Error when Procfile present #771

Closed NickLaMuro closed 4 months ago

NickLaMuro commented 4 years ago

While developing specs for https://github.com/ddollar/foreman/pull/770 I ran into this scenario (only a problem currently with those changes from #770 in place and a empty Procfile present).

Issue

With a present and empty Procfile in the root directory of the project, this has the potential to cause specs in cli_spec.rb to fail in a non-obvious way, and is not simple to debug the root cause.

Because of how forked_foreman is implemented, it doesn't included the FakeFs context to the subprocess, so it is pretty hard to deduce that it is running outside of that context, and that any generated Procfile (using write_procfile for example) will not be visible to the sub process.

To avoid this confusion and errors that might be caused from this, this error is in place to warn the user if the file currently exists and prevents running the specs with it in place.

ddollar commented 4 months ago

I was not able to reproduce the failure that you're guarding against. Where does the Procfile need to be to trigger the failure?

NickLaMuro commented 4 months ago

Not going to lie... this is from 4 years ago and 2 jobs ago... I kinda forget the context at this point...

I can maybe take a look later today.

NickLaMuro commented 4 months ago

Okay, took another look at this, and I think I understand what I was trying to do at the time. However, since this is so old, I don't have any logs of what I was doing, but here is a guess at the series of a events:

But again, this is just a guess... I can try pulling this branch down and testing to see (as well doing a git rebase off main).

ddollar commented 4 months ago

Thanks. I’ll take a look as well and see if I can figure out what might be going on.

ddollar commented 4 months ago

Got it, thanks for identifying the issue!