Skip to content

Commit d8a3daa

Browse files
authored
Merge pull request #3815 from kolyshkin/bump-bats
bump bats-core, fix some tests, use new features
2 parents 1789002 + 611bbac commit d8a3daa

File tree

8 files changed

+13
-15
lines changed

8 files changed

+13
-15
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ task:
7171
HOME: /root
7272
CIRRUS_WORKING_DIR: /home/runc
7373
GO_VERSION: "1.19"
74-
BATS_VERSION: "v1.3.0"
74+
BATS_VERSION: "v1.8.2"
7575
RPMS: gcc git iptables jq glibc-static libseccomp-devel make criu fuse-sshfs
7676
# yamllint disable rule:key-duplicates
7777
matrix:

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
- name: install bats
7373
uses: mig4/setup-bats@v1
7474
with:
75-
bats-version: 1.3.0
75+
bats-version: 1.8.2
7676

7777
- name: unit test
7878
if: matrix.rootless != 'rootless'

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG GO_VERSION=1.20
2-
ARG BATS_VERSION=v1.3.0
2+
ARG BATS_VERSION=v1.8.2
33
ARG LIBSECCOMP_VERSION=2.5.4
44

55
FROM golang:${GO_VERSION}-bullseye

libcontainer/cgroups/fs/fs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var subsystems = []subsystem{
2828
&FreezerGroup{},
2929
&RdmaGroup{},
3030
&NameGroup{GroupName: "name=systemd", Join: true},
31+
&NameGroup{GroupName: "misc", Join: true},
3132
}
3233

3334
var errSubsystemDoesNotExist = errors.New("cgroup: subsystem does not exist")

libcontainer/cgroups/systemd/v1.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var legacySubsystems = []subsystem{
6969
&fs.NetClsGroup{},
7070
&fs.NameGroup{GroupName: "name=systemd"},
7171
&fs.RdmaGroup{},
72+
&fs.NameGroup{GroupName: "misc"},
7273
}
7374

7475
func genV1ResourcesProperties(r *configs.Resources, cm *dbusConnManager) ([]systemdDbus.Property, error) {

tests/integration/checkpoint.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ function simple_cr() {
355355
runc checkpoint --work-path ./work-dir test_busybox
356356
grep -B 5 Error ./work-dir/dump.log || true
357357
[ "$status" -eq 0 ]
358-
! test -f ./work-dir/"$tmplog1"
358+
run ! test -f ./work-dir/"$tmplog1"
359359
test -f ./work-dir/"$tmplog2"
360360

361361
# after checkpoint busybox is no longer running
@@ -366,7 +366,7 @@ function simple_cr() {
366366
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
367367
grep -B 5 Error ./work-dir/restore.log || true
368368
[ "$status" -eq 0 ]
369-
! test -f ./work-dir/"$tmplog1"
369+
run ! test -f ./work-dir/"$tmplog1"
370370
test -f ./work-dir/"$tmplog2"
371371

372372
# busybox should be back up and running
@@ -434,7 +434,7 @@ function simple_cr() {
434434
[ "$status" -eq 0 ]
435435
testcontainer test_busybox checkpointed
436436
# Check that the cgroup is gone.
437-
! test -d "$orig_path"
437+
run ! test -d "$orig_path"
438438

439439
# Restore into a different cgroup.
440440
set_cgroups_path # Changes the path.
@@ -445,7 +445,7 @@ function simple_cr() {
445445
testcontainer test_busybox running
446446

447447
# Check that the old cgroup path doesn't exist.
448-
! test -d "$orig_path"
448+
run ! test -d "$orig_path"
449449

450450
# Check that the new path exists.
451451
local new_path

tests/integration/exec.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ function check_exec_debug() {
234234
# Check we can join top-level cgroup (implicit).
235235
runc exec test_busybox cat /proc/self/cgroup
236236
[ "$status" -eq 0 ]
237-
! grep -v ":$REL_CGROUPS_PATH\$" <<<"$output"
237+
run ! grep -v ":$REL_CGROUPS_PATH\$" <<<"$output"
238238

239239
# Check we can join top-level cgroup (explicit).
240240
runc exec --cgroup / test_busybox cat /proc/self/cgroup
241241
[ "$status" -eq 0 ]
242-
! grep -v ":$REL_CGROUPS_PATH\$" <<<"$output"
242+
run ! grep -v ":$REL_CGROUPS_PATH\$" <<<"$output"
243243

244244
# Create a few subcgroups.
245245
# Note that cpu,cpuacct may be mounted together or separate.

tests/integration/helpers.bash

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
set -u
44

5-
# bats-core v1.2.1 defines BATS_RUN_TMPDIR.
6-
if [ ! -v BATS_RUN_TMPDIR ]; then
7-
echo "bats >= v1.2.1 is required. Aborting." >&2
8-
exit 1
9-
fi
5+
bats_require_minimum_version 1.5.0
106

117
# Root directory of integration tests.
128
INTEGRATION_ROOT=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
@@ -357,7 +353,7 @@ function have_criu() {
357353
# Workaround for https://github.com/opencontainers/runc/issues/3532.
358354
local ver
359355
ver=$(rpm -q criu 2>/dev/null || true)
360-
! grep -q '^criu-3\.17-[123]\.el9' <<<"$ver"
356+
run ! grep -q '^criu-3\.17-[123]\.el9' <<<"$ver"
361357
}
362358

363359
# Allows a test to specify what things it requires. If the environment can't

0 commit comments

Comments
 (0)