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
ff61314d
Unverified
Commit
ff61314d
authored
Feb 25, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74478 from smarterclayton/mount_tmpfs
Ignore the sticky setgid bit when a test is running on memory EmptyDir
parents
b22da833
7f01e233
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
26 deletions
+33
-26
mount_linux_test.go
pkg/util/mount/mount_linux_test.go
+33
-26
No files found.
pkg/util/mount/mount_linux_test.go
View file @
ff61314d
...
...
@@ -633,36 +633,43 @@ func TestSafeMakeDir(t *testing.T) {
},
}
for
_
,
test
:=
range
tests
{
klog
.
V
(
4
)
.
Infof
(
"test %q"
,
test
.
name
)
base
,
err
:=
ioutil
.
TempDir
(
""
,
"safe-make-dir-"
+
test
.
name
+
"-"
)
if
err
!=
nil
{
t
.
Fatalf
(
err
.
Error
())
}
test
.
prepare
(
base
)
pathToCreate
:=
filepath
.
Join
(
base
,
test
.
path
)
err
=
doSafeMakeDir
(
pathToCreate
,
base
,
test
.
perm
)
if
err
!=
nil
&&
!
test
.
expectError
{
t
.
Errorf
(
"test %q: %s"
,
test
.
name
,
err
)
}
if
err
!=
nil
{
klog
.
Infof
(
"got error: %s"
,
err
)
}
if
err
==
nil
&&
test
.
expectError
{
t
.
Errorf
(
"test %q: expected error, got none"
,
test
.
name
)
}
if
test
.
checkPath
!=
""
{
st
,
err
:=
os
.
Stat
(
filepath
.
Join
(
base
,
test
.
checkPath
))
for
i
:=
range
tests
{
test
:=
tests
[
i
]
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
base
,
err
:=
ioutil
.
TempDir
(
""
,
"safe-make-dir-"
+
test
.
name
+
"-"
)
if
err
!=
nil
{
t
.
Errorf
(
"test %q: cannot read path %s"
,
test
.
name
,
test
.
checkPath
)
t
.
Fatalf
(
err
.
Error
()
)
}
if
st
.
Mode
()
!=
test
.
perm
{
t
.
Errorf
(
"test %q: expected permissions %o, got %o"
,
test
.
name
,
test
.
perm
,
st
.
Mode
())
defer
os
.
RemoveAll
(
base
)
test
.
prepare
(
base
)
pathToCreate
:=
filepath
.
Join
(
base
,
test
.
path
)
err
=
doSafeMakeDir
(
pathToCreate
,
base
,
test
.
perm
)
if
err
!=
nil
&&
!
test
.
expectError
{
t
.
Fatal
(
err
)
}
if
err
!=
nil
{
t
.
Logf
(
"got error: %s"
,
err
)
}
if
err
==
nil
&&
test
.
expectError
{
t
.
Fatalf
(
"expected error, got none"
)
}
}
os
.
RemoveAll
(
base
)
if
test
.
checkPath
!=
""
{
st
,
err
:=
os
.
Stat
(
filepath
.
Join
(
base
,
test
.
checkPath
))
if
err
!=
nil
{
t
.
Fatalf
(
"cannot read path %s"
,
test
.
checkPath
)
}
actualMode
:=
st
.
Mode
()
if
actualMode
!=
test
.
perm
{
if
actualMode
^
test
.
perm
==
os
.
ModeSetgid
&&
test
.
perm
&
os
.
ModeSetgid
==
0
{
// when TMPDIR is a kubernetes emptydir, the sticky gid bit is set due to fsgroup
t
.
Logf
(
"masking bit from %o"
,
actualMode
)
}
else
{
t
.
Errorf
(
"expected permissions %o, got %o (%b)"
,
test
.
perm
,
actualMode
,
test
.
perm
^
actualMode
)
}
}
}
})
}
}
...
...
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