Dne 29. 09. 22 v 15:52 Ladislav Slezák napsal(a):

>
recently I fixed a small bug in cockpit [1]. The fix is rather trivial but it 
was
quite difficult to test it and verify that it really fixes the problem.


I'm adding some more details about the integration tests.

Adding a new test was pretty simple (just check whether the switch is enabled or
disabled in the browser), but most difficult was to run the test and verify 
that it
really works.

I followed their README [2], but I was not successful in openSUSE, I was 
getting some
strange errors. It needs some Python libraries not available in openSUSE, I 
tried to
install them via "pip" but it still failed. I that point I gave up and installed
Fedora Server 36.

I used Server edition just because you do not need a full desktop for the tests 
and
it is smaller and faster to install. But if you already have a full Fedora 36 
system
installed you can use it as well.

But I highly recommend to use a virtual machine for testing, I'd not dare to run
the test on some production machine.


Here are the commands which I extracted from my bash history file. The list 
might not
be complete or in correct order. There was quite a lot of trial & error.




# first install the needed packages
dnf install nodejs dnf-utils python-srpm-macros curl expect xz rpm-build \
chromium-headless libvirt-daemon-driver-storage-core libvirt-daemon-driver-qemu 
\
libvirt-client python3-libvirt python3-flake8 python3-pyyaml git automake \
autoconf make gcc qemu-kvm

# then run these commands as root in a cockpit Git checkout:

./autogen.sh --prefix=/usr
make -j `nproc`

# I do not know why but I had to make some directories accessible,
# maybe you need to create some directories manually or just run that
# test/image-prepare command below, it likely fails but it should create this
# directory structure
chmod a+rx /root/.cache/cockpit-images/
chmod a+rx /root/.cache/
chmod a+rx /root/cockpit/test/images/
chmod a+rx /root/cockpit/test/
chmod a+rx /root/cockpit
chmod a+rx /root


# build the VM image with the new cockpit
# NOTE: you need to run it again after any change in the source code!
# (IIRC even after changing the tests!)
test/image-prepare

# run the selected testsuite
test/verify/check-networkmanager-firewall

# or run just a single test
test/verify/check-networkmanager-firewall TestFirewall.testPkcheckMissing




HTH

Ladislav


[1] https://github.com/cockpit-project/cockpit/pull/17776
[2] https://github.com/cockpit-project/cockpit/blob/main/test/README.md


--
Ladislav Slezák
YaST Developer

SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8

Reply via email to