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
8d662404
Commit
8d662404
authored
Oct 30, 2018
by
Mayank Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more ut for runasuser/runasusername
parent
5a8f8319
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
security_context_test.go
pkg/kubelet/dockershim/security_context_test.go
+24
-0
No files found.
pkg/kubelet/dockershim/security_context_test.go
View file @
8d662404
...
@@ -60,6 +60,18 @@ func TestModifyContainerConfig(t *testing.T) {
...
@@ -60,6 +60,18 @@ func TestModifyContainerConfig(t *testing.T) {
isErr
:
false
,
isErr
:
false
,
},
},
{
{
name
:
"container.SecurityContext.RunAsUsername and container.SecurityContext.RunAsUser set"
,
sc
:
&
runtimeapi
.
LinuxContainerSecurityContext
{
RunAsUsername
:
username
,
RunAsUser
:
&
runtimeapi
.
Int64Value
{
Value
:
uid
},
},
expected
:
&
dockercontainer
.
Config
{
User
:
username
,
},
isErr
:
false
,
},
{
name
:
"no RunAsUser value set"
,
name
:
"no RunAsUser value set"
,
sc
:
&
runtimeapi
.
LinuxContainerSecurityContext
{},
sc
:
&
runtimeapi
.
LinuxContainerSecurityContext
{},
expected
:
&
dockercontainer
.
Config
{},
expected
:
&
dockercontainer
.
Config
{},
...
@@ -94,6 +106,18 @@ func TestModifyContainerConfig(t *testing.T) {
...
@@ -94,6 +106,18 @@ func TestModifyContainerConfig(t *testing.T) {
},
},
isErr
:
true
,
isErr
:
true
,
},
},
{
name
:
"RunAsUser/RunAsUsername both set, RunAsGroup set"
,
sc
:
&
runtimeapi
.
LinuxContainerSecurityContext
{
RunAsUser
:
&
runtimeapi
.
Int64Value
{
Value
:
uid
},
RunAsUsername
:
username
,
RunAsGroup
:
&
runtimeapi
.
Int64Value
{
Value
:
gid
},
},
expected
:
&
dockercontainer
.
Config
{
User
:
"testuser:423"
,
},
isErr
:
false
,
},
}
}
for
_
,
tc
:=
range
cases
{
for
_
,
tc
:=
range
cases
{
...
...
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