Skip to content

Commit

Permalink
Add Vagrant tests and resolve userxattr (#106)
Browse files Browse the repository at this point in the history
Address xattr issue by mounting with userxattr. #104 
CI Vagrant test with VM running try tests on debian, rocky9, and fedora 33.
CI Vagrant test with debian VM with LVM, and debian VM with the rustup install script.
Closes #82
  • Loading branch information
ezrizhu authored Jul 11, 2023
1 parent 26f907c commit 0f98176
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/vagrant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Distro and LVM tests

on:
push:
branches:
- main
pull_request:

jobs:
vagrant:
strategy:
matrix:
vagrant_target:
- debian
- debianrustup
- debianlvm
- rocky9
- fedora33
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Start vagrant box
run: vagrant up ${{ matrix.vagrant_target }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test/bash_workspace/
test/results/
test/try_workspace/
.vagrant/
95 changes: 95 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.memory = 8192
vb.cpus = 2
end

# Regular debian testing box
config.vm.define "debian" do |debian|
debian.vm.box = "debian/testing64"
debian.vm.provision "file", source: "./", destination: "/home/vagrant/try"
debian.vm.provision "shell", privileged: false, inline: "
sudo apt update
sudo apt install -y git expect
sudo chown -R vagrant:vagrant try
cd try
bash test/run_tests.sh
"
end

# Regular debian testing box but we try the rustup oneliner
config.vm.define "debianrustup" do |debianrustup|
debianrustup.vm.box = "debian/testing64"
debianrustup.vm.provision "file", source: "./", destination: "/home/vagrant/try"
debianrustup.vm.provision "shell", privileged: false, inline: "
sudo apt update
sudo apt install -y curl
sudo chown -R vagrant:vagrant try
cd try
mkdir rustup
./try -D rustup \"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\"
ls -lah rustup/upperdir/home/vagrant/.cargo/bin
"
end

# Regular debian testing box with LVM
config.vm.define "debianlvm" do |debianlvm|
debianlvm.vm.box = "debian/testing64"
debianlvm.vm.provision "file", source: "./", destination: "/home/vagrant/try"
debianlvm.vm.provision "shell", privileged: false, inline: "
sudo apt update
sudo apt install -y git expect lvm2 mergerfs
# Create an image for the lvm disk
sudo fallocate -l 2G /root/lvm_disk.img
# Setup a loopback device
sudo losetup /dev/loop0 /root/lvm_disk.img
# Create the lv physicalvolume, volumegroup, and logicalvolumes
sudo pvcreate /dev/loop0
sudo vgcreate vg0 /dev/loop0
sudo lvcreate -n lv0 -l 50%FREE vg0
sudo lvcreate -n lv1 -l 100%FREE vg0
sudo mkfs.ext4 /dev/vg0/lv0
sudo mkfs.ext4 /dev/vg0/lv1
sudo mkdir /mnt/lv0
sudo mount /dev/vg0/lv0 /mnt/lv0
sudo mkdir /mnt/lv0/lv1
sudo mount /dev/vg0/lv1 /mnt/lv0/lv1
# This is intentional, if we moved try to lv1 it'd work since itself does not contain a nested mount
sudo mv /home/vagrant/try /mnt/lv0
sudo chown -R vagrant:vagrant /mnt/lv0/try
cd /mnt/lv0/try
bash test/run_tests.sh
"
end

# Regular rocky testing box
config.vm.define "rocky9" do |rocky|
rocky.vm.box = "generic/rocky9"
rocky.vm.provision "file", source: "./", destination: "/home/vagrant/try"
rocky.vm.provision "shell", privileged: false, inline: "
sudo yum install -y git expect
sudo chown -R vagrant:vagrant try
cd try
TRY_TOP=$(pwd) bash test/run_tests.sh
"
end
#
# Regular rocky testing box
config.vm.define "fedora33" do |fedora|
fedora.vm.box = "generic/fedora33"
fedora.vm.provision "file", source: "./", destination: "/home/vagrant/try"
fedora.vm.provision "shell", privileged: false, inline: "
sudo yum install -y git expect
sudo chown -R vagrant:vagrant try
cd try
TRY_TOP=$(pwd) bash test/run_tests.sh
"
end
end
2 changes: 1 addition & 1 deletion try
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ make_overlay() {
sandbox_dir="$1"
lowerdir="$2"
mountpoint="$3"
mount -t overlay overlay -o "lowerdir=$lowerdir,upperdir=$sandbox_dir/upperdir/$mountpoint,workdir=$sandbox_dir/workdir/$mountpoint" "$sandbox_dir/temproot/$mountpoint"
mount -t overlay overlay -o userxattr -o "lowerdir=$lowerdir,upperdir=$sandbox_dir/upperdir/$mountpoint,workdir=$sandbox_dir/workdir/$mountpoint" "$sandbox_dir/temproot/$mountpoint"
}
devices_to_mount="tty null zero full random urandom"
Expand Down

0 comments on commit 0f98176

Please sign in to comment.