mirror of
https://github.com/containers/podman.git
synced 2025-10-16 02:32:55 +08:00
Merge pull request #26238 from ArthurWuTW/26102
tmpfs: Add support for noatime mount option
This commit is contained in:
@ -8,7 +8,7 @@ t POST containers/create?name=hostconfig_test \
|
||||
Image=$IMAGE \
|
||||
Cmd='["df","-P","'$tmpfs_name'"]' \
|
||||
HostConfig='{"Binds":["/tmp/doesnotexist:/test1"]' \
|
||||
TmpFs="{\"$tmpfs_name\":\"rw\"}}" \
|
||||
TmpFs="{\"$tmpfs_name\":\"rw,noatime\"}}" \
|
||||
201 \
|
||||
.Id~[0-9a-f]\\{64\\}
|
||||
cid=$(jq -r '.Id' <<<"$output")
|
||||
@ -29,3 +29,11 @@ t GET containers/${cid}/logs?stdout=true 200
|
||||
# null bytes in the outfile.
|
||||
like "$(tr -d \\0 <$WORKDIR/curl.result.out)" ".* ${tmpfs_name}" \
|
||||
"'df' output includes tmpfs name"
|
||||
|
||||
# Reject 'noatime' for bind mount
|
||||
t POST libpod/containers/create \
|
||||
Image=$IMAGE \
|
||||
Mounts='[{"type":"bind","source":"/nosuchdir","destination":"/data","options":["noatime"]}]' \
|
||||
500 \
|
||||
.cause="invalid mount option" \
|
||||
.message~"the 'noatime' option is only allowed with tmpfs mounts"
|
||||
|
@ -1131,4 +1131,18 @@ RUN chmod 755 /test1 /test2 /test3`, ALPINE)
|
||||
outTest := podmanTest.PodmanExitCleanly("run", "--rm", "--mount", fmt.Sprintf("type=volume,src=%s,dest=/mnt", volName), ALPINE, "ls", "/mnt")
|
||||
Expect(outTest.OutputToString()).To(ContainSubstring("testfile"))
|
||||
})
|
||||
|
||||
It("podman run --tmpfs with noatime option", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--rm", "--tmpfs", "/mytmpfs:noatime", ALPINE, "grep", "mytmpfs", "/proc/self/mountinfo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output := session.OutputToString()
|
||||
Expect(output).To(ContainSubstring("noatime"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--rm", "--tmpfs", "/mytmpfs", ALPINE, "grep", "mytmpfs", "/proc/self/mountinfo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).ToNot(ContainSubstring("noatime"))
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user