-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: ensure prefixed commands do not clobber legacy default values #190
Conversation
@@ -104,36 +105,36 @@ func TestLegacyEnvVars(t *testing.T) { | |||
|
|||
o := runCLI() | |||
|
|||
require.Equal(t, o.SetupScript, legacyEnvs["SETUP_SCRIPT"]) |
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.
review: mostly just fixing expected/actual ordering
// Temporarily removed these from the default settings to prevent conflicts | ||
// between current and legacy environment variables that add default values. | ||
// Once the legacy environment variables are phased out, this can be | ||
// reinstated to the previous default values. | ||
if len(options.IgnorePaths) == 0 { | ||
options.IgnorePaths = []string{"/var/run"} | ||
} | ||
if options.InitScript == "" { | ||
options.InitScript = "sleep infinity" | ||
} | ||
if options.InitCommand == "" { | ||
options.InitCommand = "/bin/sh" | ||
} |
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.
review: moving this right to the top so it's checked first thing
@@ -44,6 +45,54 @@ const ( | |||
testImageUbuntu = "localhost:5000/envbuilder-test-ubuntu:latest" | |||
) | |||
|
|||
func TestInitScriptInitCommand(t *testing.T) { |
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.
review: this test ensures that INIT_SCRIPT and INIT_COMMAND are executed as specified.
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.
Wondering if this could get done in the previous test without having to create a new one.
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.
Which previous test?
ENVBUILDER_INIT_SCRIPT and ENVBUILDER_INIT_COMMAND default values appear to clobber the values of INIT_SCRIPT and INIT_COMMAND if set. It looks like we had already been doing something similar for
IGNORE_PATHS
, so applied the same treatment and added an integration test to ensure overriding both of these works.