ci/lava: Add unit tests covering job definition
Add two unit tests related to the LAVA job definition. test_generate_lava_job_definition_sanity checks for the most important fields, deploy actions, namespaces etc. test_lava_job_definition compares the generated definition with static skeleton YAML files committed inside tests/data folder. Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25912>
This commit is contained in:
committed by
Marge Bot
parent
fdd51ef584
commit
60cd0af06c
@@ -0,0 +1,142 @@
|
||||
job_name: 'test-project: my_pipeline_info'
|
||||
device_type: my_fastboot_device_type
|
||||
visibility:
|
||||
group:
|
||||
- my_visibility_group
|
||||
priority: 75
|
||||
context:
|
||||
extra_nfsroot_args: ' init=/init rootwait usbcore.quirks=0bda:8153:k'
|
||||
timeouts:
|
||||
job:
|
||||
minutes: 10
|
||||
actions:
|
||||
depthcharge-retry:
|
||||
minutes: 4
|
||||
depthcharge-start:
|
||||
minutes: 1
|
||||
depthcharge-action:
|
||||
minutes: 15
|
||||
actions:
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 10
|
||||
to: nfs
|
||||
nfsrootfs:
|
||||
url: None/lava-rootfs.tar.zst
|
||||
compression: zstd
|
||||
namespace: dut
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 5
|
||||
to: downloads
|
||||
os: oe
|
||||
images:
|
||||
kernel:
|
||||
url: None/None
|
||||
dtb:
|
||||
url: None/my_dtb_filename.dtb
|
||||
postprocess:
|
||||
docker:
|
||||
image: registry.gitlab.collabora.com/lava/health-check-docker
|
||||
steps:
|
||||
- cat Image.gz my_dtb_filename.dtb > Image.gz+dtb
|
||||
- mkbootimg --kernel Image.gz+dtb --cmdline "root=/dev/nfs rw nfsroot=$NFS_SERVER_IP:$NFS_ROOTFS,tcp,hard
|
||||
rootwait ip=dhcp init=/init" --pagesize 4096 --base 0x80000000 -o boot.img
|
||||
namespace: dut
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 10
|
||||
to: fastboot
|
||||
docker:
|
||||
image: registry.gitlab.collabora.com/lava/health-check-docker
|
||||
images:
|
||||
boot:
|
||||
url: downloads://boot.img
|
||||
namespace: dut
|
||||
failure_retry: 3
|
||||
- boot:
|
||||
timeout:
|
||||
minutes: 2
|
||||
docker:
|
||||
image: registry.gitlab.collabora.com/lava/health-check-docker
|
||||
failure_retry: 3
|
||||
method: fastboot
|
||||
prompts:
|
||||
- 'lava-shell:'
|
||||
commands:
|
||||
- set_active a
|
||||
namespace: dut
|
||||
auto_login:
|
||||
login_commands:
|
||||
- dropbear -R -B
|
||||
- touch /dut_ready
|
||||
login_prompt: 'ogin:'
|
||||
username: ''
|
||||
- test:
|
||||
namespace: dut
|
||||
definitions:
|
||||
- from: inline
|
||||
name: setup-ssh-server
|
||||
path: inline-setup-ssh-server
|
||||
repository:
|
||||
metadata:
|
||||
format: Lava-Test Test Definition 1.0
|
||||
name: dut-env-export
|
||||
run:
|
||||
steps:
|
||||
- |-
|
||||
echo test FASTBOOT
|
||||
- export -p > /dut-env-vars.sh
|
||||
- test:
|
||||
namespace: container
|
||||
timeout:
|
||||
minutes: 10
|
||||
failure_retry: 3
|
||||
definitions:
|
||||
- name: docker_ssh_client
|
||||
from: inline
|
||||
path: inline/docker_ssh_client.yaml
|
||||
repository:
|
||||
metadata:
|
||||
name: mesa
|
||||
description: Mesa test plan
|
||||
format: Lava-Test Test Definition 1.0
|
||||
run:
|
||||
steps:
|
||||
- |-
|
||||
set -ex
|
||||
timeout 1m bash << EOF
|
||||
while [ -z "$(lava-target-ip)" ]; do
|
||||
echo Waiting for DUT to join LAN;
|
||||
sleep 1;
|
||||
done
|
||||
EOF
|
||||
|
||||
ping -c 5 -w 60 $(lava-target-ip)
|
||||
|
||||
lava_ssh_test_case() {
|
||||
set -x
|
||||
local test_case="${1}"
|
||||
shift
|
||||
lava-test-case "${test_case}" --shell \
|
||||
ssh ${SSH_PTY_ARGS:--T} \
|
||||
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||
root@$(lava-target-ip) "${@}"
|
||||
}
|
||||
- lava_ssh_test_case 'wait_for_dut_login' << EOF
|
||||
- while [ ! -e /dut_ready ]; do sleep 1; done;
|
||||
- EOF
|
||||
- |-
|
||||
lava_ssh_test_case 'artifact_download' 'bash --' << EOF
|
||||
source /dut-env-vars.sh
|
||||
set -ex
|
||||
curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar -xz -C /
|
||||
mkdir -p /ci/project/dir
|
||||
curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar --zstd -x -C /ci/project/dir
|
||||
echo Could not find jwt file, disabling S3 requests...
|
||||
sed -i '/S3_RESULTS_UPLOAD/d' /set-job-env-vars.sh
|
||||
EOF
|
||||
- export SSH_PTY_ARGS=-tt
|
||||
- lava_ssh_test_case 'test-project_dut' '"cd / && /init-stage2.sh"'
|
||||
docker:
|
||||
image:
|
||||
@@ -0,0 +1,96 @@
|
||||
job_name: 'test-project: my_pipeline_info'
|
||||
device_type: my_fastboot_device_type
|
||||
visibility:
|
||||
group:
|
||||
- my_visibility_group
|
||||
priority: 75
|
||||
context:
|
||||
extra_nfsroot_args: ' init=/init rootwait usbcore.quirks=0bda:8153:k'
|
||||
timeouts:
|
||||
job:
|
||||
minutes: 10
|
||||
actions:
|
||||
depthcharge-retry:
|
||||
minutes: 4
|
||||
depthcharge-start:
|
||||
minutes: 1
|
||||
depthcharge-action:
|
||||
minutes: 15
|
||||
actions:
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 10
|
||||
to: nfs
|
||||
nfsrootfs:
|
||||
url: None/lava-rootfs.tar.zst
|
||||
compression: zstd
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 5
|
||||
to: downloads
|
||||
os: oe
|
||||
images:
|
||||
kernel:
|
||||
url: None/None
|
||||
dtb:
|
||||
url: None/my_dtb_filename.dtb
|
||||
postprocess:
|
||||
docker:
|
||||
image: registry.gitlab.collabora.com/lava/health-check-docker
|
||||
steps:
|
||||
- cat Image.gz my_dtb_filename.dtb > Image.gz+dtb
|
||||
- mkbootimg --kernel Image.gz+dtb --cmdline "root=/dev/nfs rw nfsroot=$NFS_SERVER_IP:$NFS_ROOTFS,tcp,hard
|
||||
rootwait ip=dhcp init=/init" --pagesize 4096 --base 0x80000000 -o boot.img
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 2
|
||||
to: fastboot
|
||||
docker:
|
||||
image: registry.gitlab.collabora.com/lava/health-check-docker
|
||||
images:
|
||||
boot:
|
||||
url: downloads://boot.img
|
||||
- boot:
|
||||
timeout:
|
||||
minutes: 2
|
||||
docker:
|
||||
image: registry.gitlab.collabora.com/lava/health-check-docker
|
||||
failure_retry: 3
|
||||
method: fastboot
|
||||
prompts:
|
||||
- 'lava-shell:'
|
||||
commands:
|
||||
- set_active a
|
||||
- test:
|
||||
timeout:
|
||||
minutes: 10
|
||||
failure_retry: 1
|
||||
definitions:
|
||||
- name: mesa
|
||||
from: inline
|
||||
lava-signal: kmsg
|
||||
path: inline/mesa.yaml
|
||||
repository:
|
||||
metadata:
|
||||
name: mesa
|
||||
description: Mesa test plan
|
||||
os:
|
||||
- oe
|
||||
scope:
|
||||
- functional
|
||||
format: Lava-Test Test Definition 1.0
|
||||
run:
|
||||
steps:
|
||||
- echo test FASTBOOT
|
||||
- set -ex
|
||||
- curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar -xz
|
||||
-C /
|
||||
- mkdir -p /ci/project/dir
|
||||
- curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar --zstd
|
||||
-x -C /ci/project/dir
|
||||
- echo Could not find jwt file, disabling S3 requests...
|
||||
- sed -i '/S3_RESULTS_UPLOAD/d' /set-job-env-vars.sh
|
||||
- mkdir -p /ci/project/dir
|
||||
- curl None | tar --zstd -x -C /ci/project/dir
|
||||
- sleep 1
|
||||
- lava-test-case 'test-project_dut' --shell /init-stage2.sh
|
||||
@@ -0,0 +1,114 @@
|
||||
job_name: 'test-project: my_pipeline_info'
|
||||
device_type: my_uboot_device_type
|
||||
visibility:
|
||||
group:
|
||||
- my_visibility_group
|
||||
priority: 75
|
||||
context:
|
||||
extra_nfsroot_args: ' init=/init rootwait usbcore.quirks=0bda:8153:k'
|
||||
timeouts:
|
||||
job:
|
||||
minutes: 10
|
||||
actions:
|
||||
depthcharge-retry:
|
||||
minutes: 4
|
||||
depthcharge-start:
|
||||
minutes: 1
|
||||
depthcharge-action:
|
||||
minutes: 15
|
||||
actions:
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 10
|
||||
to: tftp
|
||||
os: oe
|
||||
kernel:
|
||||
url: None/None
|
||||
nfsrootfs:
|
||||
url: None/lava-rootfs.tar.zst
|
||||
compression: zstd
|
||||
dtb:
|
||||
url: None/my_dtb_filename.dtb
|
||||
namespace: dut
|
||||
failure_retry: 3
|
||||
- boot:
|
||||
failure_retry: 3
|
||||
method: u-boot
|
||||
prompts:
|
||||
- 'lava-shell:'
|
||||
commands: nfs
|
||||
namespace: dut
|
||||
auto_login:
|
||||
login_commands:
|
||||
- dropbear -R -B
|
||||
- touch /dut_ready
|
||||
login_prompt: 'ogin:'
|
||||
username: ''
|
||||
- test:
|
||||
namespace: dut
|
||||
definitions:
|
||||
- from: inline
|
||||
name: setup-ssh-server
|
||||
path: inline-setup-ssh-server
|
||||
repository:
|
||||
metadata:
|
||||
format: Lava-Test Test Definition 1.0
|
||||
name: dut-env-export
|
||||
run:
|
||||
steps:
|
||||
- |-
|
||||
echo test UBOOT
|
||||
- export -p > /dut-env-vars.sh
|
||||
- test:
|
||||
namespace: container
|
||||
timeout:
|
||||
minutes: 10
|
||||
failure_retry: 3
|
||||
definitions:
|
||||
- name: docker_ssh_client
|
||||
from: inline
|
||||
path: inline/docker_ssh_client.yaml
|
||||
repository:
|
||||
metadata:
|
||||
name: mesa
|
||||
description: Mesa test plan
|
||||
format: Lava-Test Test Definition 1.0
|
||||
run:
|
||||
steps:
|
||||
- |-
|
||||
set -ex
|
||||
timeout 1m bash << EOF
|
||||
while [ -z "$(lava-target-ip)" ]; do
|
||||
echo Waiting for DUT to join LAN;
|
||||
sleep 1;
|
||||
done
|
||||
EOF
|
||||
|
||||
ping -c 5 -w 60 $(lava-target-ip)
|
||||
|
||||
lava_ssh_test_case() {
|
||||
set -x
|
||||
local test_case="${1}"
|
||||
shift
|
||||
lava-test-case "${test_case}" --shell \
|
||||
ssh ${SSH_PTY_ARGS:--T} \
|
||||
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||
root@$(lava-target-ip) "${@}"
|
||||
}
|
||||
- lava_ssh_test_case 'wait_for_dut_login' << EOF
|
||||
- while [ ! -e /dut_ready ]; do sleep 1; done;
|
||||
- EOF
|
||||
- |-
|
||||
lava_ssh_test_case 'artifact_download' 'bash --' << EOF
|
||||
source /dut-env-vars.sh
|
||||
set -ex
|
||||
curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar -xz -C /
|
||||
mkdir -p /ci/project/dir
|
||||
curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar --zstd -x -C /ci/project/dir
|
||||
echo Could not find jwt file, disabling S3 requests...
|
||||
sed -i '/S3_RESULTS_UPLOAD/d' /set-job-env-vars.sh
|
||||
EOF
|
||||
- export SSH_PTY_ARGS=-tt
|
||||
- lava_ssh_test_case 'test-project_dut' '"cd / && /init-stage2.sh"'
|
||||
docker:
|
||||
image:
|
||||
@@ -0,0 +1,70 @@
|
||||
job_name: 'test-project: my_pipeline_info'
|
||||
device_type: my_uboot_device_type
|
||||
visibility:
|
||||
group:
|
||||
- my_visibility_group
|
||||
priority: 75
|
||||
context:
|
||||
extra_nfsroot_args: ' init=/init rootwait usbcore.quirks=0bda:8153:k'
|
||||
timeouts:
|
||||
job:
|
||||
minutes: 10
|
||||
actions:
|
||||
depthcharge-retry:
|
||||
minutes: 4
|
||||
depthcharge-start:
|
||||
minutes: 1
|
||||
depthcharge-action:
|
||||
minutes: 15
|
||||
actions:
|
||||
- deploy:
|
||||
timeout:
|
||||
minutes: 5
|
||||
to: tftp
|
||||
os: oe
|
||||
kernel:
|
||||
url: None/None
|
||||
nfsrootfs:
|
||||
url: None/lava-rootfs.tar.zst
|
||||
compression: zstd
|
||||
dtb:
|
||||
url: None/my_dtb_filename.dtb
|
||||
- boot:
|
||||
failure_retry: 3
|
||||
method: u-boot
|
||||
prompts:
|
||||
- 'lava-shell:'
|
||||
commands: nfs
|
||||
- test:
|
||||
timeout:
|
||||
minutes: 10
|
||||
failure_retry: 1
|
||||
definitions:
|
||||
- name: mesa
|
||||
from: inline
|
||||
lava-signal: kmsg
|
||||
path: inline/mesa.yaml
|
||||
repository:
|
||||
metadata:
|
||||
name: mesa
|
||||
description: Mesa test plan
|
||||
os:
|
||||
- oe
|
||||
scope:
|
||||
- functional
|
||||
format: Lava-Test Test Definition 1.0
|
||||
run:
|
||||
steps:
|
||||
- echo test UBOOT
|
||||
- set -ex
|
||||
- curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar -xz
|
||||
-C /
|
||||
- mkdir -p /ci/project/dir
|
||||
- curl -L --retry 4 -f --retry-all-errors --retry-delay 60 None | tar --zstd
|
||||
-x -C /ci/project/dir
|
||||
- echo Could not find jwt file, disabling S3 requests...
|
||||
- sed -i '/S3_RESULTS_UPLOAD/d' /set-job-env-vars.sh
|
||||
- mkdir -p /ci/project/dir
|
||||
- curl None | tar --zstd -x -C /ci/project/dir
|
||||
- sleep 1
|
||||
- lava-test-case 'test-project_dut' --shell /init-stage2.sh
|
||||
Reference in New Issue
Block a user