-
-
Notifications
You must be signed in to change notification settings - Fork 10
script: Allow setting env var value from stdout #58
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
Conversation
cc @joamaki |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM ✅
I'd suggest to add a test for env
like the following:
# set an env var
env TEST=value
env TEST
cmp stdout stdout_env.txt
# set an env var from stdout
echo hello
env --from-stdout TEST
env TEST
cmp stdout stdout_env_stdout.txt
# set multiple env vars from stdout
echo world
env --from-stdout TEST1 TEST2
env TEST1
cmp stdout stdout_env_stdout_1.txt
env TEST2
cmp stdout stdout_env_stdout_2.txt
-- stdout_env.txt --
TEST=value
-- stdout_env_stdout.txt --
TEST=hello
-- stdout_env_stdout_1.txt --
TEST1=world
-- stdout_env_stdout_2.txt --
TEST2=world
f0b969c
to
d666767
Compare
@pippolo84 I agree with adding tests but I don't see any other command being tested in a txtar-style test (unless I've missed it somehow). Is this something we still want to do? I'm not sure if this was a specific reason to not have these kinds of tests in this repo. |
I see a .txtar based test for Empty and Sed, for example. I'm not aware of any limitation regarding script based tests for commands, but let's hear from @joamaki too. |
This is useful if there are commands that output values that could be used as parameters to subsequent commands. Also modify the scripttest runner when verbose mode is set to execute the "env" command using ExecuteLine() instead of running Env() directly because we now need the flags to be initialized. Co-authored-by: Fabio Falzoi <fabio.falzoi@isovalent.com> Signed-off-by: Chris Tarazi <chris@isovalent.com>
d666767
to
8b0697d
Compare
@pippolo84 Ah thanks for the pointer, I missed those files. I added what you suggested and credited you in the commit, thanks! |
This is useful if there are commands that output values that could be
used as parameters to subsequent commands.
Also modify the scripttest runner when verbose mode is set to execute
the "env" command using ExecuteLine() instead of running Env() directly
because we now need the flags to be initialized.
Signed-off-by: Chris Tarazi chris@isovalent.com