Skip to content

Commit

Permalink
Merge pull request #5611 from os-autoinst/openqa-in-5-minutes
Browse files Browse the repository at this point in the history
Add recording how to run openQA test in 5 minutes
  • Loading branch information
mergify[bot] committed May 7, 2024
2 parents 2505f72 + 5cb881b commit aaa122b
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/Installing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ podman run --name openqa --device /dev/kvm -p 1080:80 -p 1443:443 --rm -it \
Once the startup has finished, the web UI is accessible via http://localhost:1080
or https://localhost:1443.

==== How to run a test with single-instance container in 5 minutes

image::images/openqa-in-5-minutes.gif[Running openQA job within 5 minutes]

=== Separate web UI and worker containers
As an alternative also separate containers are provided for both the web UI
and worker.
Expand Down
1 change: 1 addition & 0 deletions docs/asciinema/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openqa-in-5-minutes.gif
27 changes: 27 additions & 0 deletions docs/asciinema/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1.3
FROM opensuse/tumbleweed:latest

# Install recording prerequisites
RUN zypper in -y asciinema cargo gcc make fira-code-fonts
RUN cargo install autocast && \
ln -s /root/.cargo/bin/autocast /usr/local/bin/
RUN cargo install --git https://github.com/asciinema/agg && \
ln -s /root/.cargo/bin/agg /usr/local/bin/

# Install utilities used in the recording
RUN zypper in -y bat jq retry wget

# Use http://www.brow.sh to show the web in terminal
RUN zypper in -y firefox
RUN wget -O /usr/local/bin/browsh https://github.com/browsh-org/browsh/releases/download/v1.8.2/browsh_1.8.2_linux_amd64 && \
chmod +x /usr/local/bin/browsh
RUN mkdir -p /root/.config/browsh
COPY <<EOF /root/.config/browsh/config.toml
browsh_supporter = "I have shown my support for Browsh"
[firefox]
path = "/usr/bin/firefox"
EOF

RUN mkdir -p /work
VOLUME /work
WORKDIR /work
24 changes: 24 additions & 0 deletions docs/asciinema/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
YAML_FILES=$(wildcard *.yaml)
GIF_FILES=$(YAML_FILES:.yaml=.gif)
THEME=monokai
BAT_THEME=Monokai Extended

.PHONY: all
all: build run

.PHONY: cast
cast: $(GIF_FILES)

%.cast:%.yaml
autocast --overwrite $< $@

%.gif: %.cast
agg --theme $(THEME) $< $@

.PHONY: build
build:
podman build . -t autocast

.PHONY: run
run:
podman run -e BAT_THEME="$(BAT_THEME)" --rm -ti -v .:/work --privileged --device /dev/kvm autocast make cast
102 changes: 102 additions & 0 deletions docs/asciinema/openqa-in-5-minutes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
settings:
width: 80
height: 24
title: How to run an openQA test in 5 minutes
timeout: 300s
type_speed: 50ms
environment_capture:
- HOME
- BAT_THEME
instructions:
- !Command
command: "# Install podman"
- !Command
command:
- zypper in -y podman
- !Command
# Workaround to hide some warnings due to having podman inside podman
command:
- alias podman='podman --log-level error'
hidden: true
- !Command
# Make sure the image will be downloaded, because that looks nice in the video
command:
- podman rmi
- registry.opensuse.org/devel/openqa/containers/openqa-single-instance
hidden: true
- !Marker Pull openQA container
- !Command
command: "# Pull and run openQA single instance container"
- !Command
command:
- podman run --rm -ti --name openqa --detach
- --env skip_suse_tests="" --env skip_suse_specifics=""
- --device /dev/kvm -p 1080:80 -p 1443:443
- registry.opensuse.org/devel/openqa/containers/openqa-single-instance
- !Command
# Workaround for healtchecks not working without systemd inside recording container
command: >-
( nohup retry -r 20 -s 10 -- podman healthcheck run openqa &> /dev/null & )
hidden: true
- !Command
command: podman wait --condition healthy openqa
- !Marker Clone job from openqa.opensuse.org
- !Command
command: "# Clone any job from openqa.opensuse.org"
- !Command
command:
- podman exec openqa
- openqa-clone-job https://openqa.opensuse.org/tests/4109159
- !Command
command:
- podman exec -ti openqa
- openqa-cli monitor 1
- !Wait 3s
- !Marker Prepare scenario definition
- !Command
command: "# Create scenario definition"
- !Command
command:
- wget -qO scenario-definitions.yaml
- https://raw.githubusercontent.com/os-autoinst/os-autoinst-distri-example/main/scenario-definitions.yaml
- !Command
command: bat scenario-definitions.yaml
- !Command
command: >-
podman cp scenario-definitions.yaml openqa:scenario-definitions.yaml
- !Marker Schedule product
- !Command
command: "# Schedule the product"
- !Command
command:
- podman exec -ti openqa
- openqa-cli schedule --monitor
- --param-file SCENARIO_DEFINITIONS_YAML=scenario-definitions.yaml
- DISTRI=example VERSION=0 FLAVOR=DVD ARCH=x86_64
- TEST=simple_boot _GROUP_ID=0 BUILD=test
- CASEDIR=https://github.com/os-autoinst/os-autoinst-distri-example.git
- NEEDLES_DIR=%%CASEDIR%%/needles
- !Command
command: podman exec openqa openqa-cli api jobs/2 | jq -r .job.result
- !Marker openQA web UI
- !Command
command: "# We can also use the local web UI"
- !Command
command: >-
alias xdg-open='browsh --time-limit 5 --startup-url'
hidden: true
- !Command
command: >-
xdg-open http://localhost:1080/t2
- !Command
command: pkill firefox
hidden: true
- !Marker Clean up
- !Command
command: rm -f scenario-definitions.yaml
hidden: true
- !Command
command: "# Stop the container to remove all data"
- !Command
command: podman stop openqa
1 change: 1 addition & 0 deletions docs/images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openqa-in-5-minutes.gif

0 comments on commit aaa122b

Please sign in to comment.