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

bump bats-core, fix some tests, use new features #3815

Merged
merged 3 commits into from
Apr 8, 2023
Merged
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
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ task:
HOME: /root
CIRRUS_WORKING_DIR: /home/runc
GO_VERSION: "1.19"
BATS_VERSION: "v1.3.0"
BATS_VERSION: "v1.8.2"
RPMS: gcc git iptables jq glibc-static libseccomp-devel make criu fuse-sshfs
# yamllint disable rule:key-duplicates
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: install bats
uses: mig4/setup-bats@v1
with:
bats-version: 1.3.0
bats-version: 1.8.2

- name: unit test
if: matrix.rootless != 'rootless'
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GO_VERSION=1.20
ARG BATS_VERSION=v1.3.0
ARG BATS_VERSION=v1.8.2
ARG LIBSECCOMP_VERSION=2.5.4

FROM golang:${GO_VERSION}-bullseye
Expand Down
1 change: 1 addition & 0 deletions libcontainer/cgroups/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var subsystems = []subsystem{
&FreezerGroup{},
&RdmaGroup{},
&NameGroup{GroupName: "name=systemd", Join: true},
&NameGroup{GroupName: "misc", Join: true},
}

var errSubsystemDoesNotExist = errors.New("cgroup: subsystem does not exist")
Expand Down
1 change: 1 addition & 0 deletions libcontainer/cgroups/systemd/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var legacySubsystems = []subsystem{
&fs.NetClsGroup{},
&fs.NameGroup{GroupName: "name=systemd"},
&fs.RdmaGroup{},
&fs.NameGroup{GroupName: "misc"},
}

func genV1ResourcesProperties(r *configs.Resources, cm *dbusConnManager) ([]systemdDbus.Property, error) {
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/checkpoint.bats
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function simple_cr() {
runc checkpoint --work-path ./work-dir test_busybox
grep -B 5 Error ./work-dir/dump.log || true
[ "$status" -eq 0 ]
! test -f ./work-dir/"$tmplog1"
run ! test -f ./work-dir/"$tmplog1"
test -f ./work-dir/"$tmplog2"

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

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

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

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

# Check that the new path exists.
local new_path
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ function check_exec_debug() {
# Check we can join top-level cgroup (implicit).
runc exec test_busybox cat /proc/self/cgroup
[ "$status" -eq 0 ]
! grep -v ":$REL_CGROUPS_PATH\$" <<<"$output"
run ! grep -v ":$REL_CGROUPS_PATH\$" <<<"$output"

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

# Create a few subcgroups.
# Note that cpu,cpuacct may be mounted together or separate.
Expand Down
8 changes: 2 additions & 6 deletions tests/integration/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

set -u

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

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

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