Skip to content

Commit 9acde52

Browse files
authored
Remove ~ from authorized characters in environment name (#539)
1 parent 8cb3b5a commit 9acde52

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

cmd/kosli/createEnvironment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (suite *CreateEnvironmentCommandTestSuite) TestCreateEnvironmentCmd() {
100100
wantError: true,
101101
name: "fails when name is considered invalid by the server",
102102
cmd: "create env 'foo bar' --type K8S" + suite.defaultKosliArguments,
103-
golden: "Error: Input payload validation failed: map[name:'foo bar' does not match '^[a-zA-Z0-9][a-zA-Z0-9\\\\.\\\\-_~]*$']\n",
103+
golden: "Error: Input payload validation failed: map[name:'foo bar' does not match '^[a-zA-Z0-9][a-zA-Z0-9\\\\.\\\\-_]*$']\n",
104104
},
105105
{
106106
wantError: false,

cmd/kosli/multiHost.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func runMultiHost(args []string) (string, error) {
5959
errorMessage += err0.Error()
6060
}
6161

62-
for i:=1; i < len(opts.hosts); i++ {
62+
for i := 1; i < len(opts.hosts); i++ {
6363
argsN := argsAppendHostApiTokenFlags(i)
6464
outputN, errN := runBufferedInnerMain(argsN)
6565

@@ -75,7 +75,7 @@ func runMultiHost(args []string) (string, error) {
7575
errorMessage += fmt.Sprintf("\n%s", errN.Error())
7676
}
7777
}
78-
78+
7979
var err error
8080
if errorMessage != "" {
8181
err = errors.New(errorMessage)

cmd/kosli/multiHost_test.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func (suite *MultiHostTestSuite) TestRunDoubledHost() {
121121
stdOut: []string{"OK", ""},
122122
err: error(nil),
123123
},
124-
125124
} {
126125
defer func(original []string) { os.Args = original }(os.Args)
127126
os.Args = t.args
@@ -157,7 +156,6 @@ func (suite *MultiHostTestSuite) TestRunTripledHost() {
157156
stdOut: []string{"OK", ""},
158157
err: error(nil),
159158
},
160-
161159
} {
162160
defer func(original []string) { os.Args = original }(os.Args)
163161
os.Args = t.args
@@ -261,21 +259,21 @@ func charAt(s string, n int) string {
261259
return fmt.Sprintf("%v", c)
262260
}
263261

264-
// {
265-
// name: "in debug mode also returns secondary call output",
266-
// args: doubledArgs([]string{"kosli", "status", "--debug"}),
267-
// stdOut: StatusDebugLines(),
268-
// err: error(nil),
269-
// },
270-
// {
271-
// name: "--help prints output once",
272-
// args: doubledArgs([]string{"kosli", "status", "--help"}),
273-
// stdOut: HelpStatusLines(),
274-
// err: error(nil),
275-
// },
276-
// {
277-
// name: "bad-flag never gets to call runMultiHost() because isMultiHost() returns false",
278-
// args: doubledArgs([]string{"kosli", "status", "--bad-flag"}),
279-
// stdOut: BadFlagLines(),
280-
// err: error(nil),
281-
// },
262+
// {
263+
// name: "in debug mode also returns secondary call output",
264+
// args: doubledArgs([]string{"kosli", "status", "--debug"}),
265+
// stdOut: StatusDebugLines(),
266+
// err: error(nil),
267+
// },
268+
// {
269+
// name: "--help prints output once",
270+
// args: doubledArgs([]string{"kosli", "status", "--help"}),
271+
// stdOut: HelpStatusLines(),
272+
// err: error(nil),
273+
// },
274+
// {
275+
// name: "bad-flag never gets to call runMultiHost() because isMultiHost() returns false",
276+
// args: doubledArgs([]string{"kosli", "status", "--bad-flag"}),
277+
// stdOut: BadFlagLines(),
278+
// err: error(nil),
279+
// },

cmd/kosli/renameEnvironment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (suite *RenameEnvironmentCommandTestSuite) TestRenameEnvironmentCmd() {
3939
wantError: true,
4040
name: "renaming environment fails if the new name is illegal",
4141
cmd: fmt.Sprintf(`rename environment %s 'new illegal name' %s`, suite.envName, suite.defaultKosliArguments),
42-
golden: "Error: 'new illegal name' is an invalid name for environments. Valid names should start with an alphanumeric and only contain alphanumeric characters, '.', '-', '_' and '~'.\n",
42+
golden: "Error: 'new illegal name' is an invalid name for environments. Valid names should start with an alphanumeric and only contain alphanumeric characters, '.', '-' and '_'.\n",
4343
},
4444
{
4545
wantError: true,

0 commit comments

Comments
 (0)