Skip to content
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

Use randomly generated delimiter for multiline env variables #26

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

SaschaMann
Copy link
Member

The previous discussion in #6 finally has a proper answer, this updates it to follow @actions/core: https://github.com/actions/toolkit/blob/b36e70495fbee083eb20f600eafa9091d832577d/packages/core/src/file-command.ts#L27-L47

@SaschaMann
Copy link
Member Author

Not sure how to fix that last test, please let me know if you have any ideas!

@@ -188,10 +190,12 @@ Set environment variable `k` to value `v`.
function set_env(k, v)
val = cmd_value(v)
ENV[k] = val
Copy link
Member

@ericphanson ericphanson Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting ENV should probably be moved to be after the safety-precaution checks, imo. I guess it doesn't matter if we're literally going to exit, but if we refactored that to throw or something instead, then we'd have a bug. (And I guess if someone's atexit introspects ENV then we still have a bug currently)

test/runtests.jl Outdated
if VERSION.minor < 6
mock(atexit) do ae
set_env("b", "foo$(delimiter)bar")
@test called_once_with(ae, GHA.fail)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used SimpleMock before, but it looks like called_once_with doesn't mean "called once with args X, and possibly other times", but rather "called once AND that one time it had args X": https://github.com/JuliaTesting/SimpleMock.jl/blob/4ee3c0dea7238349be2a1ce157684118cb55e135/src/mock_type.jl#L136-L142

Therefore I bet the CI failure is that atexit is being called other times too, with other args.

Copy link
Member Author

@SaschaMann SaschaMann Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used it before either, I copied the other example from the testsuite. I interpreted that docstring to refer to the specific mock, in this case ae, which has only been called once. But I'm not sure.

@christopher-dG do you know how to fix this?

@SaschaMann SaschaMann mentioned this pull request Jul 11, 2023
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