ovirt-imageio icon indicating copy to clipboard operation
ovirt-imageio copied to clipboard

Go test infrastructure

Open nirs opened this issue 2 years ago • 0 comments

The go tests require running imageio server serving an empty 6g image.

Currently running the Go tests requires lot of manual steps:

  1. Start another shell
  2. Build
make
  1. Run test server
./ovirt-imageio -c examples
  1. Start another shell and add a ticket
./ovirt-imageioctl add-ticket -c examples examples/nbd.json
  1. Create empty qcow2 image
qemu-img create -f qcow2 empty.qcow2 6g
  1. Run qemu-nbd serving the ticket
qemu-nbd -r -t -e8 -f qcow2 empty.qcow2 -k /tmp/nbd.sock
  1. Run the tests
$ go test -v ./...
?   	ovirt.org/ovirt-img	[no test files]
=== RUN   TestNbdSize
--- PASS: TestNbdSize (0.00s)
=== RUN   TestNbdExtents
--- PASS: TestNbdExtents (0.00s)
PASS
ok  	ovirt.org/ovirt-img/nbd	0.004s
?   	ovirt.org/ovirt-img/qemuimg	[no test files]

What we need is infrastructure like the python tests:

  • running imageio server per test or per module
  • easy way to add tickets - helper running ovirt-imageioctl?
  • easy way to create test image, so we can test more interesting images, not only empty images
  • easy way to run qemu-nbd, serving a test image, like python qemu_nbd.run()

nirs avatar Dec 12 '21 20:12 nirs