Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
35d972fd
Commit
35d972fd
authored
Jul 24, 2019
by
YAMAMOTO Takashi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort args to make log outputs a bit more deterministic
parent
1833b65f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
types.go
pkg/daemons/config/types.go
+2
-0
types_test.go
pkg/daemons/config/types_test.go
+39
-0
No files found.
pkg/daemons/config/types.go
View file @
35d972fd
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"net"
"net"
"net/http"
"net/http"
"sort"
"strings"
"strings"
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/authentication/authenticator"
...
@@ -164,5 +165,6 @@ func GetArgsList(argsMap map[string]string, extraArgs []string) []string {
...
@@ -164,5 +165,6 @@ func GetArgsList(argsMap map[string]string, extraArgs []string) []string {
cmd
:=
fmt
.
Sprintf
(
"--%s=%s"
,
arg
,
value
)
cmd
:=
fmt
.
Sprintf
(
"--%s=%s"
,
arg
,
value
)
args
=
append
(
args
,
cmd
)
args
=
append
(
args
,
cmd
)
}
}
sort
.
Strings
(
args
)
return
args
return
args
}
}
pkg/daemons/config/types_test.go
0 → 100644
View file @
35d972fd
package
config
import
(
"reflect"
"testing"
)
func
TestGetArgsList
(
t
*
testing
.
T
)
{
argsMap
:=
map
[
string
]
string
{
"aaa"
:
"A"
,
"bbb"
:
"B"
,
"ccc"
:
"C"
,
"ddd"
:
"d"
,
"eee"
:
"e"
,
"fff"
:
"f"
,
"ggg"
:
"g"
,
"hhh"
:
"h"
,
}
extraArgs
:=
[]
string
{
"bbb=BB"
,
"ddd=DD"
,
"iii=II"
,
}
expected
:=
[]
string
{
"--aaa=A"
,
"--bbb=BB"
,
"--ccc=C"
,
"--ddd=DD"
,
"--eee=e"
,
"--fff=f"
,
"--ggg=g"
,
"--hhh=h"
,
"--iii=II"
,
}
actual
:=
GetArgsList
(
argsMap
,
extraArgs
)
if
!
reflect
.
DeepEqual
(
actual
,
expected
)
{
t
.
Errorf
(
"got %v
\n
want %v"
,
actual
,
expected
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment