rename tests #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test backup and restore functionality | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup MinIO Server | |
uses: infleet/[email protected] | |
with: | |
port: "9000" | |
version: "latest" | |
- name: Setup MinIO client | |
uses: yakubique/setup-minio-cli@v1 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.22.4' | |
- name: "Create minio access" | |
run: | | |
mc alias set 'ci' 'http://127.0.0.1:9000' 'minioadmin' 'minioadmin' | |
mc mb ci/backups | |
mc admin user svcacct add ci minioadmin --json > /tmp/minio.json | |
- name: "Install proxmox backup client" | |
run: | | |
sudo apt update -y | |
sudo apt install jq wget gawk -y | |
sudo wget https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg | |
echo "deb http://download.proxmox.com/debian/pbs-client bullseye main" | sudo tee -a /etc/apt/sources.list.d/pbs.list | |
echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" | sudo tee -a /etc/apt/sources.list.d/pve.list | |
sudo apt update -y | |
sudo apt install -y proxmox-backup-client libproxmox-backup-qemu0-dev | |
- name: "Build Proxy and GC" | |
run: | | |
go get github.com/elbandi/go-proxmox-backup-client | |
go get github.com/schollz/progressbar/v3 | |
go build tizbac/pmoxs3backuproxy/cmd/pmoxs3backuproxy | |
go build tizbac/pmoxs3backuproxy/cmd/garbagecollector | |
go build -o fdxtest tizbac/pmoxs3backuproxy/test | |
- name: "Create backup and test restore" | |
run: | | |
echo "start proxy" | |
export PBS_PASSWORD=$(jq -r .secretKey < /tmp/minio.json) | |
export USERNAME=$(jq -r .accessKey < /tmp/minio.json) | |
export BUCKET="backups" | |
export ENDPOINT="127.0.0.1:9000" | |
export PBS_FINGERPRINT="55:BC:29:4B:BA:B6:A1:03:42:A9:D8:51:14:9D:BD:00:D2:2A:9C:A1:B8:4A:85:E1:AF:B2:0C:48:40:D6:CC:A4" | |
export PBS_REPOSITORY="$USERNAME@[email protected]:$BUCKET" | |
echo "start proxy" | |
nohup ./pmoxs3backuproxy -endpoint $ENDPOINT -bind 127.0.0.1:8007 -debug > /tmp/nohup.out 2> /tmp/nohup.err < /dev/null & | |
echo "create first backup" | |
sudo -E proxmox-backup-client backup proxy.pxar:. --backup-id testbackup > /tmp/first_backup 2>&1 | |
cat /tmp/first_backup | |
sleep 5 | |
echo "create second backup" | |
echo new-data > changed | |
sudo -E proxmox-backup-client backup proxy.pxar:. --backup-id testbackup > /tmp/second_backup 2>&1 | |
cat /tmp/second_backup | |
echo "check if second backup was done incrementally" | |
grep -q "backup was done incrementally" /tmp/second_backup | |
echo "restore first backup" | |
proxmox-backup-client snapshot list | |
proxmox-backup-client snapshot list > /tmp/backups 2>&1 > /tmp/backups 2>&1 | |
VER=$(grep -m 1 testbackup /tmp/backups | awk '{print $2 }') | |
echo $VER | |
rm -rf /tmp/restore | |
sudo -E proxmox-backup-client restore "$VER" proxy.pxar /tmp/restore/ | |
find /tmp/restore > /dev/null | |
echo "check notes api" | |
sudo -E proxmox-backup-client snapshot notes update "$VER" mynote | |
sudo -E proxmox-backup-client snapshot notes show "$VER" | grep -q mynote | |
echo "check files api" | |
sudo -E proxmox-backup-client snapshot files "$VER" | grep -q "proxy.pxar" | |
echo "check protection api" | |
proxmox-backup-client snapshot protected show "$VER" | grep -q false | |
proxmox-backup-client snapshot protected update "$VER" true | |
proxmox-backup-client snapshot protected show "$VER" | grep -q true | |
proxmox-backup-client snapshot protected update "$VER" false | |
echo "run fixed index backup" | |
./fdxtest -repo "$PBS_REPOSITORY" -password "$PBS_PASSWORD" | |
echo "run GC" | |
./garbagecollector -endpoint $ENDPOINT -accesskey "$USERNAME" -secretkey "$PBS_PASSWORD" -bucket backups | |
echo "list backups" | |
proxmox-backup-client list | |
echo "forget snapshot" | |
proxmox-backup-client snapshot forget "$VER" |