Skip to content

Conversation

@NickLaMuro
Copy link
Contributor

While developing specs for #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.

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
Copy link
Owner

ddollar commented Apr 12, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor Author

NickLaMuro commented Apr 12, 2024

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
Copy link
Owner

ddollar commented Apr 12, 2024

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

@ddollar ddollar closed this in 3a26271 Apr 12, 2024
@ddollar
Copy link
Owner

ddollar commented Apr 12, 2024

Got it, thanks for identifying the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants