openSUSE:OpenQA:Workshop

Jump to: navigation, search

If you want to run openQA during the workshop

There are different ways to run openQA, some are more permanent than others.

We will focus on "Quick bootstrapping under openSUSE" but keep in mind that there are other ways, like a container based setup or using GitHub Code Spaces.

Container based setup

If you are using the container based setup: (Keep in mind the container will be removed if you close the terminal where it is running)

podman run --name openqa --device /dev/kvm -p 1080:80 -p 1443:443 -p 5991:5991 --rm -it \
 registry.opensuse.org/devel/openqa/containers/openqa-single-instance

The -p 5991:5991 allow you to connect to the vnc port of the single worker, when a job is running and you enter into developer mode

And on a second terminal, enter into the container

podman exec -ti openqa /bin/bash

An additional step is to clone the needles:

cd /var/lib/openqa/share/tests
git clone --depth 1  https://github.com/os-autoinst/os-autoinst-distri-opensuse opensuse
cd /var/lib/openqa/share/tests/opensuse/products/opensuse/
git clone --depth 1 https://github.com/os-autoinst/os-autoinst-needles-opensuse needles
chown geekotest:nogroup needles # so we can create new needles

Directly on your machine

zypper in openQA-bootstrap
/usr/share/openqa/script/openqa-bootstrap # as root :)

No local openQA way

Follow this guide

openQA client keys

Ask the presenter to update the host ip address

The file could be either /etc/openqa/client.conf or ~/.config/openqa/client.conf depending on your setup

 cat >> /etc/openqa/client.conf <<EOF
[10.0.13.134]
key = AC9CDAC00A09053F
secret = 40317E94C45F4FAD
EOF

Some more setup

The test distribution requires some extra dependencies in case you want to run make tidy to lint the code you are producing.

zypper in python3-yamllint os-autoinst-devel cpanm

Once this is done, in the directory where your tests are (i.e /var/lib/openqa/share/tests/opensuse) you need to run

cd /var/lib/openqa/share/tests/opensuse
make prepare

and once more run the following command, to ensure you have a working environment

make tidy

Start hacking

Regardless of the method used, we can now follow along.

You might want to fork these two repositories on github (osado and the needles), so you can submit your changes

https://github.com/os-autoinst/os-autoinst-distri-opensuse
https://github.com/os-autoinst/os-autoinst-needles-opensuse

Cloning a job

In our container or system:

openqa-clone-job --skip-chained-deps 10.0.13.134/tests/33

If you want to directly push your changes to github, and use that as test repository

openqa-clone-job --skip-chained-deps 192.168.178.10/tests/32 CASEDIR=https://github.com/$yourfork/os-autoinst-distri-opensuse.git#$yourbranch

Creating our first test module

Create a new file myrlyn.pm in tests/x11

# SUSE's openQA tests
#
# Copyright SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Test that myrlyn is able to start
# Maintainer: you@email.com

use base "x11test";
use strict;
use warnings;
use testapi;

sub run {
    ensure_installed('myrlyn');
    #start myrlyn in read-only mode
    x11_start_program('myrlyn');
    send_key 'alt-f4';
}

1;

More documentation

There is more documentation at https://open.qa/documentation/ but for test development the following two: