Skip to content

Conversation

johnstcn
Copy link
Member

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.

@johnstcn johnstcn requested review from BrunoQuaresma and mtojek May 14, 2024 14:59
@johnstcn johnstcn self-assigned this May 14, 2024

o := runCLI()

require.Equal(t, o.SetupScript, legacyEnvs["SETUP_SCRIPT"])
Copy link
Member Author

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

Comment on lines +89 to +101
// 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"
}
Copy link
Member Author

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

testImageUbuntu = "localhost:5000/envbuilder-test-ubuntu:latest"
)

func TestInitScriptInitCommand(t *testing.T) {
Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Which previous test?

@johnstcn johnstcn merged commit 51e54f2 into main May 14, 2024
@johnstcn johnstcn deleted the cj/fix-legacy-default-opts branch May 14, 2024 15:54
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