Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed May 22, 2023
1 parent ac1a240 commit d8f95ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 139 deletions.
79 changes: 2 additions & 77 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,6 @@
# NOTE Cirrus execution environments lack a terminal, needed for
# some integration tests. So we use `ssh -tt` command to fake a terminal.

task:
timeout_in: 30m

env:
DEBIAN_FRONTEND: noninteractive
HOME: /root
# yamllint disable rule:key-duplicates
matrix:
DISTRO: fedora

name: vagrant DISTRO:$DISTRO

compute_engine_instance:
image_project: cirrus-images
image: family/docker-kvm
platform: linux
nested_virtualization: true
# CPU limit: `16 / NTASK`: see https://cirrus-ci.org/faq/#are-there-any-limits
cpu: 8
# Memory limit: `4GB * NCPU`
memory: 32G

host_info_script: |
uname -a
# -----
cat /etc/os-release
# -----
df -T
# -----
cat /proc/cpuinfo
install_libvirt_vagrant_script: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
apt-get update
apt-get install -y libvirt-daemon libvirt-daemon-system vagrant
systemctl enable --now libvirtd
apt-get build-dep -y vagrant ruby-libvirt
apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
vagrant plugin install vagrant-libvirt
vagrant_cache:
fingerprint_script: uname -s ; cat Vagrantfile.$DISTRO
folder: /root/.vagrant.d
vagrant_up_script: |
ln -sf Vagrantfile.$DISTRO Vagrantfile
# Retry if it fails (download.fedoraproject.org returns 404 sometimes)
vagrant up --no-tty || vagrant up --no-tty
mkdir -p -m 0700 /root/.ssh
vagrant ssh-config >> /root/.ssh/config
guest_info_script: |
ssh default 'sh -exc "uname -a && systemctl --version && df -T && cat /etc/os-release && go version"'
check_config_script: |
ssh default /vagrant/script/check-config.sh
unit_tests_script: |
ssh default 'sudo -i make -C /vagrant localunittest'
integration_systemd_script: |
ssh -tt default "sudo -i make -C /vagrant localintegration RUNC_USE_SYSTEMD=yes"
integration_fs_script: |
ssh -tt default "sudo -i make -C /vagrant localintegration"
integration_systemd_rootless_script: |
ssh -tt default "sudo -i make -C /vagrant localrootlessintegration RUNC_USE_SYSTEMD=yes"
integration_fs_rootless_script: |
ssh -tt default "sudo -i make -C /vagrant localrootlessintegration"
task:
timeout_in: 30m

Expand All @@ -81,8 +17,6 @@ task:
RPMS: gcc git iptables jq glibc-static libseccomp-devel make criu fuse-sshfs
# yamllint disable rule:key-duplicates
matrix:
DISTRO: centos-7
DISTRO: centos-stream-8
DISTRO: centos-stream-9

name: ci / $DISTRO
Expand Down Expand Up @@ -173,14 +107,5 @@ task:
ssh -tt localhost "make -C /home/runc localintegration RUNC_USE_SYSTEMD=yes"
integration_fs_script: |
ssh -tt localhost "make -C /home/runc localintegration"
integration_systemd_rootless_script: |
echo "SKIP: integration_systemd_rootless_script requires cgroup v2"
integration_fs_rootless_script: |
case $DISTRO in
centos-7)
echo "SKIP: FIXME: integration_fs_rootless_script is skipped because of EPERM on writing cgroup.procs"
;;
centos-stream-8)
ssh -tt localhost "make -C /home/runc localrootlessintegration"
;;
esac
oom_check_script: |
ssh -tt localhost 'cd /home/runc && for i in $(seq 1 100); do bats -T tests/integration/events.bats; done'
62 changes: 0 additions & 62 deletions tests/integration/events.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,6 @@ function teardown() {
teardown_bundle
}

# shellcheck disable=SC2030
@test "events --stats" {
# XXX: currently cgroups require root containers.
requires root
init_cgroup_paths

# run busybox detached
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]

# generate stats
runc events --stats test_busybox
[ "$status" -eq 0 ]
[[ "${lines[0]}" == [\{]"\"type\""[:]"\"stats\""[,]"\"id\""[:]"\"test_busybox\""[,]* ]]
[[ "${lines[0]}" == *"data"* ]]
}

function test_events() {
# XXX: currently cgroups require root containers.
requires root
init_cgroup_paths

local status interval retry_every=1
if [ $# -eq 2 ]; then
interval="$1"
retry_every="$2"
fi

runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
# shellcheck disable=SC2031
[ "$status" -eq 0 ]

# Spawn two subshels:
# 1. Event logger that sends stats events to events.log.
(__runc events ${interval:+ --interval "$interval"} test_busybox >events.log) &
# 2. Waits for an event that includes test_busybox then kills the
# test_busybox container which causes the event logger to exit.
(
retry 10 "$retry_every" grep -q test_busybox events.log
__runc delete -f test_busybox
) &
wait # for both subshells to finish

[ -e events.log ]

output=$(head -1 events.log)
[[ "$output" == [\{]"\"type\""[:]"\"stats\""[,]"\"id\""[:]"\"test_busybox\""[,]* ]]
[[ "$output" == *"data"* ]]
}

@test "events --interval default" {
test_events
}

@test "events --interval 1s" {
test_events 1s 1
}

@test "events --interval 100ms" {
test_events 100ms 0.1
}

@test "events oom" {
# XXX: currently cgroups require root containers.
requires root cgroups_swap
Expand Down

0 comments on commit d8f95ab

Please sign in to comment.