-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (77 loc) · 3.35 KB
/
integration-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Run integration tests
on:
pull_request:
types: [labeled, synchronize, reopened]
paths-ignore:
- 'docs/**'
jobs:
integration-tests:
runs-on: ubuntu-22.04
if: contains(github.event.pull_request.labels.*.name, 'integration-tests')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Setup MicroCeph
run: |
set -x
sudo snap install microceph --channel=quincy/stable
sudo apt-get update
sudo apt-get install --no-install-recommends -y ceph-common
sudo microceph cluster bootstrap
sudo microceph.ceph config set global osd_pool_default_size 1
sudo microceph.ceph config set global mon_allow_pool_delete true
sudo microceph.ceph config set global osd_memory_target 939524096
sudo microceph.ceph osd crush rule rm replicated_rule
sudo microceph.ceph osd crush rule create-replicated replicated default osd
for flag in nosnaptrim noscrub nobackfill norebalance norecover noscrub nodeep-scrub; do
sudo microceph.ceph osd set $flag
done
# Repurpose the ephemeral disk for ceph OSD.
sudo swapoff /mnt/swapfile
ephemeral_disk="$(findmnt --noheadings --output SOURCE --target /mnt | sed 's/[0-9]\+$//')"
sudo microceph disk add --wipe "${ephemeral_disk}"
sudo rm -rf /etc/ceph
sudo ln -s /var/snap/microceph/current/conf/ /etc/ceph
sudo microceph enable rgw
sudo ceph osd pool create devpool 8
# Wait until there are no more "unkowns" pgs
for _ in $(seq 60); do
if sudo microceph.ceph pg stat | grep -wF unknown; then
sleep 1
else
break
fi
done
sudo microceph.ceph status
sudo rbd create --size 5000 --pool devpool test-img
sudo rm -f /snap/bin/rbd
sudo chmod 644 /etc/ceph/ceph.client.admin.keyring
- name: Set Environment Variables
run: |
echo "CEPH_MONITORS=$(hostname):6789" >> $GITHUB_ENV
echo "CEPH_IMAGE=devpool/test-img" >> $GITHUB_ENV
echo "CEPH_USERNAME=admin" >> $GITHUB_ENV
echo "CEPH_USERKEY=`ceph auth print-key client.admin`" >> $GITHUB_ENV
- name: Install dependencies
run: |
set -x
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
qemu-utils ca-certificates libvirt-clients libcephfs-dev \
librbd-dev librados-dev libc-bin gcc
sudo apt-get install -y qemu-kvm libvirt-daemon-system
sudo systemctl enable --now libvirtd
sudo usermod -aG kvm,libvirt,tty $USER
sudo usermod -aG $(id -gn $USER) libvirt-qemu
sudo setfacl -m user:$USER:rw /var/run/libvirt/libvirt-sock
sudo update-ca-certificates
sudo rm -rf /var/lib/apt/lists
sudo sed -i '$a\ devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=0660 0 0' /etc/fstab
sudo mount -o remount /dev/pts
- name: Run integration tests
# Starting a new instance of the Bash shell to reflect the added permissions
run: sudo -H -E -u $USER bash -c 'make integration-tests'