Initial import.

This commit is contained in:
Jarek Prokop 2024-02-22 14:38:20 +01:00
commit 33db2e0e28
20 changed files with 234 additions and 0 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Jaroslav Prokop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,5 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

View file

@ -0,0 +1 @@
require 'aruba/cucumber'

View file

@ -0,0 +1,31 @@
Feature: Simple tests to showcase that Aruba works
Background:
Given a file named "hello-world" with:
"""
Ahoy!
"""
Scenario: Functioning executable
Given an executable named "bin/example-cli" with:
"""
#!/usr/bin/bash
echo "Hi!"
"""
When I successfully run `bin/example-cli`
Then the output should contain:
"""
Hi!
"""
Scenario: Using background step definition
Given an executable named "bin/example-cli-2" with:
"""
#!/usr/bin/bash
cat "./hello-world"
"""
When I successfully run `bin/example-cli-2`
Then the output should contain:
"""
Ahoy!
"""

View file

@ -0,0 +1,6 @@
summary: Test an example cucumber test suite with Aruba
test: ./test.sh
require+:
- rubygem-cucumber
- rubygem-aruba

View file

@ -0,0 +1,24 @@
#!/bin/sh -eux
PACKAGE=${PACKAGE:-}
[ -n "$PACKAGE" ] || {
echo "env variable \$PACKAGE not specified, specify what package are we testing." >&2
exit 1
}
tmp=$(mktemp -d)
cp -r features "$tmp"
pushd "$tmp"
cucumber > test_out.txt
# Provide a way for this test to fail. If something
# is undefined, the exit code of `cucumber` is 0,
# which will not fail the execution of this file.
grep -q "2 scenarios (2 passed)" test_out.txt
grep -q "8 steps (8 passed)" test_out.txt
popd
rm -rf "$tmp"

View file

@ -0,0 +1,9 @@
summary: Run basic cucumber test suite to test compatibility.
test: ./test.sh
require+:
- git
- rubygem-jekyll
- rubygem-jekyll-email-protect
- rubygem-cucumber
- rubygem-rspec

View file

@ -0,0 +1,22 @@
#!/bin/sh -eux
PACKAGE=${PACKAGE:-}
[ -n "$PACKAGE" ] || {
echo "env variable \$PACKAGE not specified, specify what package are we testing."
exit 1
}
echo $(rpm -qa "$PACKAGE")
tmp=$(mktemp -d)
pushd "$tmp"
git clone "https://gitlab.com/jackorp/jekyll-git-authors.git"
pushd jekyll-git-authors
cucumber .
popd
popd
rm -rf "$tmp"

View file

@ -0,0 +1,7 @@
summary: Reverse rebuild a dependency with scratch build artifact
test: ./test.sh
require+:
- mock
- python3-koji
- fedpkg

View file

@ -0,0 +1,2 @@
environment:
BUILD_PACKAGE: rubygem-aruba

View file

@ -0,0 +1,2 @@
environment:
BUILD_PACKAGE: rubygem-cucumber-wire

View file

@ -0,0 +1,2 @@
environment:
BUILD_PACKAGE: rubygem-cucumber

View file

@ -0,0 +1,2 @@
environment:
BUILD_PACKAGE: rubygem-nifti

View file

@ -0,0 +1,2 @@
environment:
BUILD_PACKAGE: rubygem-rspec-expectations

View file

@ -0,0 +1,2 @@
environment:
BUILD_PACKAGE: rubygem-rspec-mocks

View file

@ -0,0 +1,42 @@
#!/bin/sh -eux
BUILD_PACKAGE=${BUILD_PACKAGE:-}
KOJI_TASK_ID=${KOJI_TASK_ID:-}
[ -n "$BUILD_PACKAGE" ] || {
echo "env variable \$BUILD_PACKAGE not specified, specify what package are we testing." >&2
exit 1
}
[ -n "$KOJI_TASK_ID" ] || {
echo "env variable \$KOJI_TASK_ID not specified" >&2
echo "This variable should be present in TestingFarm" >&2
exit 1
}
# Inspired by sut_install_commands.sh script available in TestingFarm run
( koji download-build --debuginfo --task-id --arch noarch --arch x86_64 --arch i686 $KOJI_TASK_ID || koji download-task --arch noarch --arch x86_64 --arch i686 $KOJI_TASK_ID ) | grep -E Downloading | cut -d " " -f 3 | tee "rpms-list-$KOJI_TASK_ID"
ls *[^.src].rpm | sed -r "s/(.*)-.*-.*/\1 \0/" | grep -Ev "i686" | awk "{print \$2}" | tee rpms-list
# Prep mock with the packages here, otherwise we'd have to do a bit of
# gymnastics to set the paths correctly in rpms-list.
mock -r fedora-rawhide-x86_64 --verbose -i $(cat rpms-list)
tmp=$(mktemp -d)
pushd $tmp
fedpkg clone -a "rpms/$BUILD_PACKAGE"
# Previous clone will create a directory named after $BUILD_PACKAGE
# if it doesn't exist, it failed, so checking path exists seems pointless
pushd "$BUILD_PACKAGE"
srpm_path=$(fedpkg --release rawhide srpm | grep Wrote | cut -d':' -f2 | tr -d ' ')
# After fedpkg srpm we expect only a single package.
mock -r fedora-rawhide-x86_64 --verbose --no-clean "$srpm_path"
# No other checks on reverse built artifacts should be needed.
# install checks should be in other tests as it's not a focus of this one.
popd
popd
rm -rf "$tmp"

View file

@ -0,0 +1,2 @@
summary: Verify functional installation of the rubygem-aruba package
test: ./test.sh

View file

@ -0,0 +1,23 @@
#!/bin/sh -eux
PACKAGE=${PACKAGE:-}
[ -n "$PACKAGE" ] || {
echo "env variable \$PACKAGE not specified, specify what package are we testing."
exit 1
}
present=$(rpm -qa $PACKAGE)
# We assume dnf install privileges
dnf install -y rubygem-aruba
after_install=$(rpm -qa $PACKAGE)
[ "$present" = "$after_install" ] || {
echo "Mismatch of $PACKAGE NVR after installing cucumber."
echo "BEFORE --> $present"
echo "AFTER --> $after_install"
exit 1
}

View file

@ -0,0 +1,2 @@
summary: Verify functional installation of the main cucumber package
test: ./test.sh

View file

@ -0,0 +1,27 @@
#!/bin/sh -eux
PACKAGE=${PACKAGE:-}
[ -n "$PACKAGE" ] || {
echo "env variable \$PACKAGE not specified, specify what package are we testing."
exit 1
}
present=$(rpm -qa $PACKAGE)
# We assume dnf install privileges
dnf install -y rubygem-cucumber
after_install=$(rpm -qa $PACKAGE)
[ "$present" = "$after_install" ] || {
echo "Mismatch of $PACKAGE NVR after installing cucumber."
echo "BEFORE --> $present"
echo "AFTER --> $after_install"
exit 1
}
cucumber --help
cucumber --version