Skip to content

Improve convert interface #108

Improve convert interface

Improve convert interface #108

Workflow file for this run

name: test
on:
push:
branches:
- master
pull_request:
jobs:
integration:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run golangci-lint
uses: golangci/[email protected]
with:
version: v1.60.1
args: --verbose
- name: Install qemu-img as a test dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-utils
- name: Unit tests
run: go test -v ./...
- name: Install go-qcow2reader-example
run: cd ./cmd/go-qcow2reader-example && go install
- name: Cache test-images-ro
id: cache-test-images-ro
uses: actions/cache@v4
with:
path: test-images-ro
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/test.yml') }}
- name: Prepare test-images-ro
if: steps.cache-test-images-ro.outputs.cache-hit != 'true'
run: |
set -eux -o pipefail
mkdir -p test-images-ro
cd test-images-ro
# version: 3, virtual size: 2GiB, cluster size: 16 bits (65536 bytes)
curl -SL -O https://cloud.debian.org/images/cloud/bullseye/20230501-1367/debian-11-genericcloud-amd64-20230501-1367.qcow2
# Create a child image, with a custom size
qemu-img create -f qcow2 -b debian-11-genericcloud-amd64-20230501-1367.qcow2 -F qcow2 debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2 4G
# TODO: write something to the child image (with qemu-nbd?)
# Convert to zstd
qemu-img convert -f qcow2 -O qcow2 -o compression_type=zstd debian-11-genericcloud-amd64-20230501-1367.qcow2 debian-11-genericcloud-amd64-20230501-1367.zstd.qcow2
# Convert to ext_l2
qemu-img convert -f qcow2 -O qcow2 -o extended_l2=on debian-11-genericcloud-amd64-20230501-1367.qcow2 debian-11-genericcloud-amd64-20230501-1367.ext_l2.qcow2
- name: Prepare test-images
run: cp -a test-images-ro test-images
- name: "Test debian-11-genericcloud-amd64-20230501-1367.qcow2"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.qcow2
- name: "Test debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2 (child image, with a custom size)"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2
- name: "Test debian-11-genericcloud-amd64-20230501-1367.zstd.qcow2"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.zstd.qcow2
- name: "Test debian-11-genericcloud-amd64-20230501-1367.ext_l2.qcow2"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.ext_l2.qcow2