Skip to content

Commit

Permalink
.travis.yml: add Fedora 31 vagrant box (for cgroup2)
Browse files Browse the repository at this point in the history
As the baby step, only unit tests are executed.

Failing tests are currently skipped and will be fixed in follow-up PRs.

Fix #2124

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Oct 31, 2019
1 parent e57a774 commit ccd4436
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .travis.yml
@@ -1,4 +1,4 @@
dist: xenial
dist: bionic
language: go
go:
- 1.11.x
Expand All @@ -13,6 +13,20 @@ matrix:
script:
- make BUILDTAGS="${BUILDTAGS}" all
- sudo PATH="$PATH" make localintegration RUNC_USE_SYSTEMD=1
- go: 1.12.x
env:
- VIRTUALBOX_VERSION=6.0
- VAGRANT_VERSION=2.2.6
- FEDORA_VERSION=31
before_install:
- cat /proc/cpuinfo
- wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - && sudo sh -c "echo deb https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib >> /etc/apt/sources.list" && sudo apt-get update && sudo apt-get install -yq build-essential gcc make linux-headers-$(uname -r) virtualbox-${VIRTUALBOX_VERSION} && sudo usermod -aG vboxusers $(whoami)
- wget https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_$(uname -m).deb && sudo dpkg -i vagrant_${VAGRANT_VERSION}_$(uname -m).deb
- vagrant init bento/fedora-${FEDORA_VERSION} && vagrant up && mkdir -p ~/.ssh && vagrant ssh-config >> ~/.ssh/config
- ssh default sudo dnf install -y podman
script:
- ssh default sudo podman build -t test /vagrant
- ssh default sudo podman run --privileged --cgroupns=private test make localunittest
allow_failures:
- go: tip

Expand Down
4 changes: 3 additions & 1 deletion libcontainer/cgroups/cgroups_test.go
Expand Up @@ -11,7 +11,9 @@ func TestParseCgroups(t *testing.T) {
if err != nil {
t.Fatal(err)
}

if IsCgroup2UnifiedMode() {
return
}
if _, ok := cgroups["cpu"]; !ok {
t.Fail()
}
Expand Down
25 changes: 25 additions & 0 deletions libcontainer/cgroups/fs/apply_raw_test.go
Expand Up @@ -7,10 +7,14 @@ import (
"strings"
"testing"

"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/configs"
)

func TestInvalidCgroupPath(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -42,6 +46,9 @@ func TestInvalidCgroupPath(t *testing.T) {
}

func TestInvalidAbsoluteCgroupPath(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -74,6 +81,9 @@ func TestInvalidAbsoluteCgroupPath(t *testing.T) {

// XXX: Remove me after we get rid of configs.Cgroup.Name and configs.Cgroup.Parent.
func TestInvalidCgroupParent(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -107,6 +117,9 @@ func TestInvalidCgroupParent(t *testing.T) {

// XXX: Remove me after we get rid of configs.Cgroup.Name and configs.Cgroup.Parent.
func TestInvalidAbsoluteCgroupParent(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -140,6 +153,9 @@ func TestInvalidAbsoluteCgroupParent(t *testing.T) {

// XXX: Remove me after we get rid of configs.Cgroup.Name and configs.Cgroup.Parent.
func TestInvalidCgroupName(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -174,6 +190,9 @@ func TestInvalidCgroupName(t *testing.T) {

// XXX: Remove me after we get rid of configs.Cgroup.Name and configs.Cgroup.Parent.
func TestInvalidAbsoluteCgroupName(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -207,6 +226,9 @@ func TestInvalidAbsoluteCgroupName(t *testing.T) {

// XXX: Remove me after we get rid of configs.Cgroup.Name and configs.Cgroup.Parent.
func TestInvalidCgroupNameAndParent(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down Expand Up @@ -240,6 +262,9 @@ func TestInvalidCgroupNameAndParent(t *testing.T) {

// XXX: Remove me after we get rid of configs.Cgroup.Name and configs.Cgroup.Parent.
func TestInvalidAbsoluteCgroupNameAndParent(t *testing.T) {
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}
root, err := getCgroupRoot()
if err != nil {
t.Errorf("couldn't get cgroup root: %v", err)
Expand Down
5 changes: 5 additions & 0 deletions libcontainer/integration/checkpoint_test.go
Expand Up @@ -11,6 +11,7 @@ import (
"testing"

"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/configs"

"golang.org/x/sys/unix"
Expand Down Expand Up @@ -59,6 +60,10 @@ func testCheckpoint(t *testing.T, userns bool) {
if testing.Short() {
return
}
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}

root, err := newTestRoot()
if err != nil {
t.Fatal(err)
Expand Down
18 changes: 18 additions & 0 deletions libcontainer/integration/exec_test.go
Expand Up @@ -14,6 +14,7 @@ import (
"testing"

"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runtime-spec/specs-go"
Expand Down Expand Up @@ -206,6 +207,9 @@ func TestEnter(t *testing.T) {
if testing.Short() {
return
}
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}

rootfs, err := newRootfs()
ok(t, err)
Expand Down Expand Up @@ -512,6 +516,9 @@ func testFreeze(t *testing.T, systemd bool) {
if testing.Short() {
return
}
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}

rootfs, err := newRootfs()
ok(t, err)
Expand Down Expand Up @@ -566,6 +573,10 @@ func testCpuShares(t *testing.T, systemd bool) {
if testing.Short() {
return
}
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}

rootfs, err := newRootfs()
ok(t, err)
defer remove(rootfs)
Expand Down Expand Up @@ -597,6 +608,9 @@ func testPids(t *testing.T, systemd bool) {
if testing.Short() {
return
}
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}

rootfs, err := newRootfs()
ok(t, err)
Expand Down Expand Up @@ -680,6 +694,10 @@ func testRunWithKernelMemory(t *testing.T, systemd bool) {
if testing.Short() {
return
}
if cgroups.IsCgroup2UnifiedMode() {
t.Skip("cgroup v1 is not supported")
}

rootfs, err := newRootfs()
ok(t, err)
defer remove(rootfs)
Expand Down

0 comments on commit ccd4436

Please sign in to comment.