Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timens to default generated config.json #4573

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libcontainer/specconv/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ func Example() *specs.Spec {
{
Type: specs.MountNamespace,
},
{
Type: specs.TimeNamespace,
},
},
},
}
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,14 @@ function teardown() {
requires timens

# Create a detached container with the namespaces we want. We notably want
# to include both userns and timens, which require config-related
# configuration.
# to include userns, which require config-related configuration.
if [ $EUID -eq 0 ]; then
update_config '.linux.namespaces += [{"type": "user"}]
| .linux.uidMappings += [{"containerID": 0, "hostID": 100000, "size": 100}]
| .linux.gidMappings += [{"containerID": 0, "hostID": 200000, "size": 200}]'
remap_rootfs
fi
update_config '.linux.namespaces += [{"type": "time"}]
| .linux.timeOffsets = {
update_config '.linux.timeOffsets = {
"monotonic": { "secs": 7881, "nanosecs": 2718281 },
"boottime": { "secs": 1337, "nanosecs": 3141519 }
}'
Expand Down
9 changes: 3 additions & 6 deletions tests/integration/timens.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ function teardown() {
requires timens

update_config '.process.args = ["cat", "/proc/self/timens_offsets"]'
update_config '.linux.namespaces += [{"type": "time"}]
| .linux.timeOffsets = null'
update_config '.linux.timeOffsets = null'

runc run test_busybox
[ "$status" -eq 0 ]
Expand All @@ -42,8 +41,7 @@ function teardown() {
requires timens

update_config '.process.args = ["cat", "/proc/self/timens_offsets"]'
update_config '.linux.namespaces += [{"type": "time"}]
| .linux.timeOffsets = {
update_config '.linux.timeOffsets = {
"monotonic": { "secs": 7881, "nanosecs": 2718281 },
"boottime": { "secs": 1337, "nanosecs": 3141519 }
}'
Expand All @@ -64,8 +62,7 @@ function teardown() {
remap_rootfs

update_config '.process.args = ["cat", "/proc/self/timens_offsets"]'
update_config '.linux.namespaces += [{"type": "time"}]
| .linux.timeOffsets = {
update_config '.linux.timeOffsets = {
"monotonic": { "secs": 7881, "nanosecs": 2718281 },
"boottime": { "secs": 1337, "nanosecs": 3141519 }
}'
Expand Down