#1 Add tests ported from OS CI project
Opened a year ago by mgahagan. Modified a year ago
rpms/ mgahagan/json-glib master  into  master

empty or binary file added
file added
+107

@@ -0,0 +1,107 @@ 

+ component:

+   arches:

+   - all

+   name: json-glib

+   tcms: 22941

+ 

+ dependencies:

+   beaker-tasks:

+   - /desktop/rhel7/install

+   packages:

+   - json-glib

+ 

+ beaker-hardware:

+ - x86_64:

+     group: desktop

+     variant: Workstation

+ 

+ setup:

+ 

+ cleanup:

+ 

+ testmapper:

+ - json-glib-array.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/array.test'

+ - json-glib-boxed.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/boxed.test'

+ - json-glib-builder.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/builder.test'

+ - json-glib-generator.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/generator.test'

+ - json-glib-gvariant.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/gvariant.test'

+ - json-glib-invalid.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/invalid.test'

+ - json-glib-node.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/node.test'

+ - json-glib-object.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/object.test'

+ - json-glib-parser.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/parser.test'

+ - json-glib-path.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/path.test'

+ - json-glib-reader.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/reader.test'

+ - json-glib-serialize-complex.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/serialize-complex.test'

+ - json-glib-serialize-full.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/serialize-full.test'

+ - json-glib-serialize-simple.test:

+     dir: tests/upstream-testset

+     package-deps:

+     - json-glib

+     - json-glib-tests

+     run: ./runtest.sh 'json-glib/serialize-simple.test'

+ 

@@ -0,0 +1,5 @@ 

+ [access]

+ 	inheritFrom = desktopqe-parent

+ [project]

+ 	description = json-glib tests\n\

+ Primary contact:tpelka@redhat.com

@@ -0,0 +1,25 @@ 

+ [STH_SETUP_DEFINITION]

+ #Optional STH 'Setup' section is used to install and/or configure the test environment before running the actual tests.

+ 

+ #required, to enable STH type 'setup' task before running the STH tests. True/False

+ setup=False

+ 

+ [STH_TEST_DEFINITION]

+ #STH 'Test' section is used configure the proper tasks, packages, etc. before execution of the components tests

+ 

+ str_sth=TEST_MAPPER=True

+ str_distroRequires=variant=Workstation

+ str_hostRequires=group=desktop

+ 

+ #required, to define the component name (case sensitive)

+ component=json-glib

+ 

+ #optional to define the additional tasks to run before running STH (case sensitive)

+ automation_requires1=/desktop/rhel7/install

+ automation_requires1_params=

+ 

+ #required (case sensitive)

+ aut_requires_rpms=json-glib

+ 

+ #requred to define the total expected run time for this component

+ runtime=1h

file added
+15

@@ -0,0 +1,15 @@ 

+ #Testname , Relative workdir under component, Command and args , Pkg Dependencies

+ json-glib-array.test, tests/upstream-testset, ./runtest.sh 'json-glib/array.test', json-glib;json-glib-tests, 10m

+ json-glib-boxed.test, tests/upstream-testset, ./runtest.sh 'json-glib/boxed.test', json-glib;json-glib-tests, 10m

+ json-glib-builder.test, tests/upstream-testset, ./runtest.sh 'json-glib/builder.test', json-glib;json-glib-tests, 10m

+ json-glib-generator.test, tests/upstream-testset, ./runtest.sh 'json-glib/generator.test', json-glib;json-glib-tests, 10m

+ json-glib-gvariant.test, tests/upstream-testset, ./runtest.sh 'json-glib/gvariant.test', json-glib;json-glib-tests, 10m

+ json-glib-invalid.test, tests/upstream-testset, ./runtest.sh 'json-glib/invalid.test', json-glib;json-glib-tests, 10m

+ json-glib-node.test, tests/upstream-testset, ./runtest.sh 'json-glib/node.test', json-glib;json-glib-tests, 10m

+ json-glib-object.test, tests/upstream-testset, ./runtest.sh 'json-glib/object.test', json-glib;json-glib-tests, 10m

+ json-glib-parser.test, tests/upstream-testset, ./runtest.sh 'json-glib/parser.test', json-glib;json-glib-tests, 10m

+ json-glib-path.test, tests/upstream-testset, ./runtest.sh 'json-glib/path.test', json-glib;json-glib-tests, 10m

+ json-glib-reader.test, tests/upstream-testset, ./runtest.sh 'json-glib/reader.test', json-glib;json-glib-tests, 10m

+ json-glib-serialize-complex.test, tests/upstream-testset, ./runtest.sh 'json-glib/serialize-complex.test', json-glib;json-glib-tests, 10m

+ json-glib-serialize-full.test, tests/upstream-testset, ./runtest.sh 'json-glib/serialize-full.test', json-glib;json-glib-tests, 10m

+ json-glib-serialize-simple.test, tests/upstream-testset, ./runtest.sh 'json-glib/serialize-simple.test', json-glib;json-glib-tests, 10m

file added
+58

@@ -0,0 +1,58 @@ 

+ ---

+ # tests for classic, container and atomic

+ - hosts: localhost

+   roles:

+   - role: standard-test-basic

+     tags:

+     - classic

+     - container

+     tests:

+     - json-glib-array.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/array.test'

+     - json-glib-boxed.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/boxed.test'

+     - json-glib-builder.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/builder.test'

+     - json-glib-generator.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/generator.test'

+     - json-glib-gvariant.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/gvariant.test'

+     - json-glib-invalid.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/invalid.test'

+     - json-glib-node.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/node.test'

+     - json-glib-object.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/object.test'

+     - json-glib-parser.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/parser.test'

+     - json-glib-path.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/path.test'

+     - json-glib-reader.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/reader.test'

+     - json-glib-serialize-complex.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/serialize-complex.test'

+     - json-glib-serialize-full.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/serialize-full.test'

+     - json-glib-serialize-simple.test:

+         dir: upstream-testset

+         run: ./runtest.sh 'json-glib-1.0/serialize-simple.test'

+     required_packages:

+     - json-glib

+     - json-glib-tests

+     - sudo

+     - gnome-desktop-testing

+     - glib2-tests

+ 

@@ -0,0 +1,47 @@ 

+ #!/bin/bash -x

+ 

+ # Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material

+ # is made available to anyone wishing to use, modify, copy, or

+ # redistribute it subject to the terms and conditions of the GNU General

+ # Public License v.2.

+ #

+ # This program is distributed in the hope that it will be useful, but WITHOUT ANY

+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

+ # PARTICULAR PURPOSE. See the GNU General Public License for more details.

+ #

+ # You should have received a copy of the GNU General Public License

+ # along with this program; if not, write to the Free Software

+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

+ #

+ # Author: Tomas Pelka <tpelka@redhat.com>

+ set -x

+ 

+ ARCH=$(uname -m)

+ LOG=/tmp/$TEST

+ T=$1

+ user=test

+ 

+ #Check if test user exists

+ grep -e "^$user:" /etc/passwd > /dev/null

+ if [ $? -ne 0 ]; then

+     adduser $user

+ fi

+ 

+ if rpm -q gnome-desktop-testing 1>/dev/null; then

+     echo "gnome-desktop-testing already installed"

+ else

+     echo "The gnome-desktop-testing package is required in order to run this test."

+ 	echo "Please install gnome-desktop-testing and re-run the test."

+ 	exit 2

+ fi

+ 

+ sudo -u $user ginsttest-runner $T 2>&1 >$LOG

+ rc=$?

+ RESULT=FAIL

+ if [ $rc -eq 0 ]; then

+   RESULT="PASS"

+ fi

+ 

+ echo "Result is: $RESULT"

+ 

+ exit $rc

Adds tests according to the CI wiki [0] specifically the standard test interface in the spec [1].

The playbook includes Tier1 level test cases that have been tested in the following contexts and is passing reliably: Docker, and Classic. No tests are suitable for Atomic Host at this time due to package requirements
Test logs are stored in the artifacts directory.

The following steps are used to execute the tests using the standard test interface:

Docker
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=docker:docker.io/library/fedora:26 TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags container tests.yml

Classic
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS="" TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags classic tests.yml

[0] https://fedoraproject.org/wiki/CI
[1] https://fedoraproject.org/wiki/Changes/InvokingTests

Sample test output (container)

<snipping package="" installation="" logs="">
TASK [standard-test-basic : Execute tests] *********
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-array.test': {u'run': u"./runtest.sh 'json-glib-1.0/array.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-boxed.test': {u'run': u"./runtest.sh 'json-glib-1.0/boxed.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-builder.test': {u'run': u"./runtest.sh 'json-glib-1.0/builder.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-generator.test': {u'run': u"./runtest.sh 'json-glib-1.0/generator.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-gvariant.test': {u'run': u"./runtest.sh 'json-glib-1.0/gvariant.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-invalid.test': {u'run': u"./runtest.sh 'json-glib-1.0/invalid.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-node.test': {u'run': u"./runtest.sh 'json-glib-1.0/node.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-object.test': {u'run': u"./runtest.sh 'json-glib-1.0/object.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-parser.test': {u'run': u"./runtest.sh 'json-glib-1.0/parser.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-path.test': {u'run': u"./runtest.sh 'json-glib-1.0/path.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-reader.test': {u'run': u"./runtest.sh 'json-glib-1.0/reader.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-serialize-complex.test': {u'run': u"./runtest.sh 'json-glib-1.0/serialize-complex.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-serialize-full.test': {u'run': u"./runtest.sh 'json-glib-1.0/serialize-full.test'", u'dir': u'upstream-testset'}})
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b] => (item={u'json-glib-serialize-simple.test': {u'run': u"./runtest.sh 'json-glib-1.0/serialize-simple.test'", u'dir': u'upstream-testset'}})

TASK [standard-test-basic : Pull out the logs] *********
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b]

TASK [standard-test-basic : Check the results] *********
changed: [be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b]

PLAY RECAP ***************
be83559b3a47217eee3d53aab91af1650c6babe7f08da76bcb79a0d3079a6a7b : ok=12 changed=8 unreachable=0 failed=0

sample test output log (each test logs details to its own file):

  • set -x
    ++ uname -m
  • ARCH=x86_64
  • LOG=/tmp/json-glib-array.test
  • T=json-glib-1.0/array.test
  • user=test
  • grep -e '^test:' /etc/passwd
  • '[' 0 -ne 0 ']'
  • rpm -q gnome-desktop-testing
  • echo 'gnome-desktop-testing already installed'
    gnome-desktop-testing already installed
  • sudo -u test ginsttest-runner json-glib-1.0/array.test
    Running test: json-glib-1.0/array.test
    /array/empty-array: OK
    /array/add-element: OK
    /array/remove-element: OK
    /array/foreach-element: OK
    PASS: json-glib-1.0/array.test
    SUMMARY: total=1; passed=1; skipped=0; failed=0; user=0.0s; system=0.0s; maxrss=4680
  • rc=0
  • RESULT=FAIL
  • '[' 0 -eq 0 ']'
  • RESULT=PASS
  • echo 'Result is: PASS'
    Result is: PASS
  • exit 0