This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate studio-xxx parameters (#210)
`--studio-file` -> `--runbook` `--studio-channel-name` -> `--set-channel-name` `--studio-channel-icon` -> `--set-channel-icon`
- Loading branch information
Showing
10 changed files
with
159 additions
and
66 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G" | ||
installation_id: "WAtB86RsD8koFOgnAEX63TU0mafWsqAj" | ||
release_version: "0.0.2" | ||
studio_channel_name: "integration-test-helm" | ||
set_channel_name: "integration-test-helm" | ||
|
||
skip_cleanup: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package flags | ||
|
||
import ( | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func GetCurrentOrDeprecatedString(v *viper.Viper, currentKey string, deprecatedKey string) string { | ||
currentKeyValue := v.GetString(currentKey) | ||
if currentKeyValue == "" { | ||
return v.GetString(deprecatedKey) | ||
} | ||
return currentKeyValue | ||
} |
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,65 @@ | ||
package flags | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/viper" | ||
) | ||
|
||
func Test_GetCurrentOrDeprecatedString(t *testing.T) { | ||
currentStringViperExample := viper.New() | ||
currentStringViperExample.Set("currentFlag", "123") | ||
|
||
deprecatedStringViperExample := viper.New() | ||
deprecatedStringViperExample.Set("deprecatedFlag", "456") | ||
|
||
currentAndDeprecatedStringViperExample := viper.New() | ||
currentAndDeprecatedStringViperExample.Set("currentFlag", "123") | ||
currentAndDeprecatedStringViperExample.Set("deprecatedFlag", "456") | ||
|
||
type args struct { | ||
v *viper.Viper | ||
currentKey string | ||
deprecatedKey string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
name: "Current", | ||
args: args{ | ||
v: currentStringViperExample, | ||
currentKey: "currentFlag", | ||
deprecatedKey: "deprecatedFlag", | ||
}, | ||
want: "123", | ||
}, | ||
{ | ||
name: "Deprecated", | ||
args: args{ | ||
v: deprecatedStringViperExample, | ||
currentKey: "currentFlag", | ||
deprecatedKey: "deprecatedFlag", | ||
}, | ||
want: "456", | ||
}, | ||
{ | ||
name: "Current and deprecated favors current", | ||
args: args{ | ||
v: currentAndDeprecatedStringViperExample, | ||
currentKey: "currentFlag", | ||
deprecatedKey: "deprecatedFlag", | ||
}, | ||
want: "123", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := GetCurrentOrDeprecatedString(tt.args.v, tt.args.currentKey, tt.args.deprecatedKey); got != tt.want { | ||
t.Errorf("getCurrentOrDeprecatedFlagString() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
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