Skip to content

Commit

Permalink
.travis.yml: add cgroup v2 Vagrant box
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Nov 8, 2019
1 parent 3ecfbc4 commit f083f36
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
@@ -1,9 +1,27 @@
dist: bionic
language: go
go:
- 1.11.x
- 1.12.x
- 1.13.x

matrix:
include:
- 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 golang
script:
- ssh default sudo mkdir -p /go/src/github.com/containerd/cgroups
- cd $GOPATH/src/github.com/containerd/cgroups && tar c . | ssh default sudo tar Cx /go/src/github.com/containerd/cgroups
- ssh default sudo GOPATH=/go sh -c "cd /go/src/github.com/containerd/cgroups && go test -v ./..."

go_import_path: github.com/containerd/cgroups

install:
Expand Down
3 changes: 3 additions & 0 deletions paths_test.go
Expand Up @@ -114,6 +114,9 @@ func TestEmptySubsystem(t *testing.T) {
}

func TestSystemd240(t *testing.T) {
if isUnified {
t.Skipf("requires the system to be running in legacy mode")
}
const data = `8:net_cls:/
7:memory:/system.slice/docker.service
6:freezer:/
Expand Down
30 changes: 30 additions & 0 deletions testutil_test.go
@@ -0,0 +1,30 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package cgroups

import (
"golang.org/x/sys/unix"
)

var isUnified bool

func init() {
var st unix.Statfs_t
if err := unix.Statfs("/sys/fs/cgroup", &st); err == nil {
isUnified = st.Type == unix.CGROUP2_SUPER_MAGIC
}
}

0 comments on commit f083f36

Please sign in to comment.