Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions .github/workflows/jepsen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ on:

jobs:
jepsen:
# Requires a self-hosted runner with VirtualBox + Vagrant and at least 12GB RAM free.
runs-on: [self-hosted, virtualbox]
# Requires a runner with KVM support (e.g. larger GitHub runners or metal) for decent performance.
# Standard ubuntu-latest might fall back to QEMU TCG (very slow) or fail if kvm driver is forced.
# runs-on: ubuntu-latest
runs-on: [self-hosted]

timeout-minutes: 120
steps:
- name: Checkout
Expand All @@ -35,9 +38,39 @@ jobs:
with:
go-version: "1.25.5"

- name: Install Vagrant and Libvirt
run: |
sudo apt-get update
sudo apt-get install -y vagrant ruby-libvirt qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils libvirt-dev gcc make

# Check KVM support
echo "Checking KVM support..."
if [ -r /dev/kvm ]; then
echo "KVM is available."
else
echo "WARNING: KVM is NOT available. VMs may run very slowly or fail."
fi

# Setup Libvirt permissions
sudo usermod -aG libvirt $USER
# Allow current session to access libvirt socket
sudo chmod 666 /var/run/libvirt/libvirt-sock

# Install Vagrant plugins
vagrant plugin install vagrant-libvirt
vagrant plugin install vagrant-scp

- name: Bring up Jepsen VMs
working-directory: jepsen
run: vagrant up
run: |
if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then
echo "KVM is available. Using kvm driver."
export LIBVIRT_DRIVER=kvm
else
echo "KVM is NOT available or not writable. Falling back to qemu driver (slow)."
export LIBVIRT_DRIVER=qemu
fi
vagrant up --provider=libvirt

- name: Run Jepsen workload
working-directory: jepsen
Expand Down
12 changes: 10 additions & 2 deletions jepsen/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@ Vagrant.configure("2") do |config|

# VirtualBox (Intel) defaults
node.vm.provider "virtualbox" do |vb|
vb.memory = name == :ctrl ? 4096 : 2048
vb.memory = name == :ctrl ? 2048 : 1024
vb.cpus = 2
end

# UTM (Apple Silicon) defaults
node.vm.provider "utm" do |utm|
utm.memory = name == :ctrl ? 4096 : 2048
utm.memory = name == :ctrl ? 2048 : 1024
Comment on lines +22 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Halving the memory allocation for both VirtualBox and UTM providers is a significant change that could impact the stability of the Jepsen test environment.

  • Control Node (2GB): The control node runs Jepsen (on a JVM) and compiles Go code. Both are memory-intensive operations, and 2GB might be insufficient, leading to Out-Of-Memory errors or slow performance.
  • Worker Nodes (1GB): The worker nodes run the elastickv service. 1GB of RAM might not be enough, depending on the service's memory footprint, especially under test load.

This change introduces a high risk of making the test environment unreliable.

For better maintainability and to avoid duplicating the memory values, consider defining them as variables at a higher scope. This would also make it easier for other developers to adjust them based on their system's resources.

Example:

# At the top of the Vagrantfile
CTRL_MEM = 2048
NODE_MEM = 1024

# ... then in the provider blocks
vb.memory = name == :ctrl ? CTRL_MEM : NODE_MEM
# and
utm.memory = name == :ctrl ? CTRL_MEM : NODE_MEM

Even better would be to allow overriding from environment variables:

CTRL_MEM = ENV.fetch('VAGRANT_CTRL_MEM', 2048)
NODE_MEM = ENV.fetch('VAGRANT_NODE_MEM', 1024)

utm.cpus = 2
end

node.vm.provider "libvirt" do |kvm, override|
override.vm.box = "generic/debian12"
kvm.memory = name == :ctrl ? 4096 : 2048
kvm.cpus = 2
# 必要に応じてドライバを指定
kvm.driver = ENV['LIBVIRT_DRIVER'] || 'kvm'
end

if name == :ctrl
node.vm.synced_folder "..", "/home/vagrant/elastickv",
type: "rsync",
Expand Down
Loading