-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix porter-debug parameter wiring Ensure that --debug sets PORTER_DEBUG bundle parameter at runtime when a bundle is executed. * Wire up --debug to kubernetes mixin debug context Use this to print commands run by the mixin in debug mode * Improve detection of PORTER_DEBUG at runtime The old code worked but only because Porter was helping by not setting PORTER_DEBUG when it was false.
- Loading branch information
Showing
9 changed files
with
82 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package context | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNew_Debug(t *testing.T) { | ||
t.Run("porter_debug unset", func(t *testing.T) { | ||
os.Unsetenv("PORTER_DEBUG") | ||
|
||
c := New() | ||
assert.False(t, c.Debug, "debug should be false when the env var is not present") | ||
}) | ||
|
||
t.Run("porter_debug false", func(t *testing.T) { | ||
defer os.Unsetenv("PORTER_DEBUG") | ||
os.Setenv("PORTER_DEBUG", "false") | ||
c := New() | ||
assert.False(t, c.Debug, "debug should be false when the env var is set to 'false'") | ||
}) | ||
|
||
t.Run("porter_debug invalid", func(t *testing.T) { | ||
defer os.Unsetenv("PORTER_DEBUG") | ||
os.Setenv("PORTER_DEBUG", "blorp") | ||
c := New() | ||
assert.False(t, c.Debug, "debug should be false when the env var is not a bool") | ||
}) | ||
|
||
t.Run("porter_debug true", func(t *testing.T) { | ||
os.Setenv("PORTER_DEBUG", "true") | ||
c := New() | ||
assert.True(t, c.Debug, "debug should be true when the env var is 'true'") | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters