#2 add gating tests
Merged 3 years ago by lsm5. Opened 3 years ago by santiago.
rpms/ santiago/oci-seccomp-bpf-hook gating_tests_master  into  master

file added
+14
@@ -0,0 +1,14 @@ 

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_context: bodhi_update_push_stable

+ subject_type: koji_build

+ rules:

+   - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_context: bodhi_update_push_testing

+ subject_type: koji_build

+ rules:

+   - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

file modified
+25 -3
@@ -30,7 +30,7 @@ 

  # To build a random user's fork/commit, comment out above line,

  # uncomment below line and replace the placeholders and commit0 below with the right info

  #%%global git0 https://github.com/$GITHUB_USER/$GITHUB_USER_REPO

- %global commit0 4e42394b75ecb2185d18dd3a7872df1dec5d3bcb

+ %global commit0 50e7112d7d2677e8f44ef1d6e743397c1de22521

  %global shortcommit0 %(c=%{commit0}; echo ${c:0:7})

  

  # Used for comparing with latest upstream tag
@@ -42,7 +42,7 @@ 

  

  Name: oci-seccomp-bpf-hook

  Version: 1.2.2

- Release: 0.1.git%{shortcommit0}%{?dist}

+ Release: 0.2.git%{shortcommit0}%{?dist}

  Summary: OCI Hook to generate seccomp json files based on EBF syscalls used by container

  License: ASL 2.0

  URL: %{git0}
@@ -64,6 +64,18 @@ 

  %{repo} provides a library for applications looking to use

  the Container Pod concept popularized by Kubernetes.

  

+ %package tests

+ Summary: Tests for %{name}

+ 

+ Requires: %{name} = %{version}-%{release}

+ Requires: bats

+ Requires: podman

+ 

+ %description tests

+ %{summary}

+ 

+ This package contains system tests for %{name}

+ 

  %prep

  %autosetup -Sgit -n %{name}-%{commit0}

  sed -i '/$(MAKE) -C docs install/d' Makefile
@@ -80,7 +92,7 @@ 

  export CGO_CFLAGS="$CGO_CFLAGS -fcf-protection"

  %endif

  %endif

- # These extra flags present in %%{optflags} have been skipped for now as they break the build   

+ # These extra flags present in %%{optflags} have been skipped for now as they break the build

  #export CGO_CFLAGS="$CGO_CFLAGS -flto=auto -Wp,D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"

  

  mkdir _build
@@ -102,6 +114,9 @@ 

  %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install-nobuild

  %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} GOMD2MAN=go-md2man -C docs install-nobuild

  

+ install -d -p %{buildroot}/%{_datadir}/%{name}/test/system

+ cp -pav test/. %{buildroot}/%{_datadir}/%{name}/test/system

+ 

  %check

  %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}

  # Since we aren't packaging up the vendor directory we need to link
@@ -130,7 +145,14 @@ 

  %{_datadir}/containers/oci/hooks.d/%{name}.json

  %{_mandir}/man1/%{name}.1*

  

+ %files tests

+ %license LICENSE

+ %{_datadir}/%{name}/test

+ 

  %changelog

+ * Thu Jan 28 2021 Eduardo Santiago <santiago@redhat.com> - 1.2.1-2

+ - add -tests subpackage, and gating-test invocations

+ 

  * Wed Jan 27 2021 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.2-0.1.git4e42394

  - built latest master commit

  

file added
+14
@@ -0,0 +1,14 @@ 

+ #!/bin/bash -e

+ 

+ # Log program and kernel versions

+ echo "Important package versions:"

+ (

+     uname -r

+     rpm -qa | egrep 'podman|conmon|crun|runc|iptable|slirp|systemd|container-selinux' | sort

+ ) | sed -e 's/^/  /'

+ 

+ # Log environment; or at least the useful bits

+ echo "Environment:"

+ env | grep -v LS_COLORS= | sort | sed -e 's/^/  /'

+ 

+ bats /usr/share/oci-seccomp-bpf-hook/test/system

file added
+14
@@ -0,0 +1,14 @@ 

+ ---

+ - hosts: localhost

+   roles:

+     - role: standard-test-basic

+       tags:

+         - classic

+         - container

+       required_packages:

+         - oci-seccomp-bpf-hook-tests

+       tests:

+         - root-test:

+             dir: ./

+             run: ./test_osbh.sh

+             timeout: 15m

That is:
. a -tests subpackage containing the 'test' subdirectory
. a gating.yaml file of the proper form
. a tests subdirectory containing the proper incantations

Signed-off-by: Ed Santiago santiago@redhat.com

@lsm5 @vrothberg PTAL

Note that since this branch fetches source by SHA, not tag, it should work (assuming someone does the necessary magic with the sources file, which this PR leaves as an exercise for a future reader)

Pull-Request has been merged by lsm5

3 years ago