#1 Initial commit for downstream tests using standard test interface
Opened 6 years ago by rasibley. Modified 6 years ago
rpms/ rasibley/iscsi-initiator-utils iscsi-initiator-utils-tests  into  rawhide

@@ -0,0 +1,71 @@ 

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile of /kernel/storage/iscsi/iscsiadm_iface

+ #   Description: tests basic commands of iscsiadm iface mode

+ #   Author: Martin Hoyer <mhoyer@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2017 Red Hat, Inc. All rights reserved.

+ #

+ #   This program is free software: you can redistribute it and/or

+ #   modify it under the terms of the GNU General Public License as

+ #   published by the Free Software Foundation, either version 3 of

+ #   the License, or (at your option) any later version.

+ #

+ #   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, see http://www.gnu.org/licenses/.

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 

+ # The toplevel namespace within which the test lives.

+ TOPLEVEL_NAMESPACE=kernel

+ 

+ # The name of the package under test:

+ PACKAGE_NAME=storage

+ 

+ # The path of the test below the package:

+ RELATIVE_PATH=iscsi/iscsiadm_iface

+ 

+ # Version of the Test. Used with make tag.

+ export TESTVERSION=1.0

+ 

+ # The combined namespace of the test.

+ export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE 

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Martin Hoyer <mhoyer@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     tests basic commands of iscsiadm iface mode" >> $(METADATA)

+ 	@echo "TestTime:        1m" >> $(METADATA)

+ 	@echo "RunFor:          $(PACKAGE_NAME)" >> $(METADATA)

+ 	@echo "Requires:        $(PACKAGE_NAME)" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv3" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

+ 

@@ -0,0 +1,2 @@ 

+ PURPOSE of /kernel/storage/iscsi/iscsiadm_iface

+ This test checks functionality of basic iscsiadm iface mode commands

@@ -0,0 +1,65 @@ 

+ #!/bin/bash

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /kernel/storage/iscsi/iscsiadm_iface

+ #   Description: tests basic commands of iscsiadm iface mode

+ #   Author: Martin Hoyer <mhoyer@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2017 Red Hat, Inc. All rights reserved.

+ #

+ #   This program is free software: you can redistribute it and/or

+ #   modify it under the terms of the GNU General Public License as

+ #   published by the Free Software Foundation, either version 3 of

+ #   the License, or (at your option) any later version.

+ #

+ #   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, see http://www.gnu.org/licenses/.

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 

+ # Include rhts environment

+ . /usr/bin/rhts-environment.sh

+ . /usr/lib/beakerlib/beakerlib.sh

+ 

+ PACKAGE="iscsi-initiator-utils"

+ IFACE="test_iface"

+ IFACE_FILE="/var/lib/iscsi/ifaces/$IFACE"

+ IFACE_IP="255.255.255.255"

+ IFACE_IQN="iqn.1994-05.com.redhat:test-iqn"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         if ! rlCheckRpm $PACKAGE; then

+             yum install -y $PACKAGE

+         fi

+         rlAssertRpm $PACKAGE

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         #Creating new interface

+         rlRun "iscsiadm -m iface -o new -I $IFACE"

+         rlAssertExists $IFACE_FILE

+         rlAssertGrep "iface.iscsi_ifacename = test_iface" $IFACE_FILE 

+         #Updating interface IP and IQN

+         rlRun "iscsiadm -m iface -I $IFACE -o update -n iface.ipaddress -v $IFACE_IP" 0 "Updating iface IP"

+         rlAssertGrep "iface.ipaddress = $IFACE_IP" $IFACE_FILE

+         rlRun "iscsiadm -m iface -I $IFACE -o update -n iface.initiatorname -v $IFACE_IQN" 0 "Updating iface IQN"

+         rlAssertGrep "iface.initiatorname = $IFACE_IQN" $IFACE_FILE

+         rlServiceStart iscsid

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "iscsiadm -m iface -I $IFACE -o delete" 0 "Deleting test interface"

+         rlServiceRestore iscsid

+     rlPhaseEnd

+ 

+ rlJournalEnd

+ # Print the test report

+ rlJournalPrintText

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

+ ---

+ - hosts: localhost

+   roles:

+   - role: standard-test-beakerlib

+     tags:

+     - classic

+     - container

+     tests:

+     - iscsiadm_iface

+     required_packages:

+     - findutils         # beakerlib needs find command

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.
Test logs are stored in the Artifacts directory. Currently tests are not suitable for Atomic but may be updated later to support it.

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

  • Atomic
    sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=../atomic.qcow2 TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags atomic tests.yml

  • Docker
    sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_DEBUG=1 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

Test Logs: (If you would like a pointer to the complete log, I can include that as well)

  • Docker
    <snip>
    15:47:37 TASK [standard-test-beakerlib : Execute beakerlib tests]
    15:47:45 changed: [b90c849c8f215459cf367bb25d1a2c21f159ce0b57d62a4fbe76ffe8b9115138] => (item=iscsiadm_iface)
    15:47:45
    15:47:45 TASK [standard-test-beakerlib : Make the master test summary log artifact]
    15:47:46 changed: [b90c849c8f215459cf367bb25d1a2c21f159ce0b57d62a4fbe76ffe8b9115138] => (item=iscsiadm_iface)
    15:47:46
    15:47:46 TASK [standard-test-beakerlib : Pull out the logs]
    15:47:46 changed: [b90c849c8f215459cf367bb25d1a2c21f159ce0b57d62a4fbe76ffe8b9115138]
    15:47:46
    15:47:46 TASK [standard-test-beakerlib : Check the results]
    15:47:47 changed: [b90c849c8f215459cf367bb25d1a2c21f159ce0b57d62a4fbe76ffe8b9115138]
    15:47:47
    15:47:47 PLAY RECAP
    15:47:47 b90c849c8f215459cf367bb25d1a2c21f159ce0b57d62a4fbe76ffe8b9115138 : ok=15 changed=10 unreachable=0 failed=0
    15:47:47
    15:47:47 ###################################
    15:47:47 Test results:
    15:47:47 ###################################
    15:47:47 PASS iscsiadm_iface

  • Classic
    <snip>
    15:45:05 ==> default: TASK [standard-test-beakerlib : Execute beakerlib tests]
    15:45:07 ==> default: changed: [localhost] => (item=iscsiadm_iface)
    15:45:08 ==> default:
    15:45:08 ==> default: TASK [standard-test-beakerlib : Make the master test summary log artifact]
    15:45:08 ==> default: changed: [localhost] => (item=iscsiadm_iface)
    15:45:08 ==> default:
    15:45:08 ==> default: TASK [standard-test-beakerlib : Pull out the logs]
    15:45:08 ==> default: changed: [localhost]
    15:45:08 ==> default:
    15:45:08 ==> default: TASK [standard-test-beakerlib : Check the results]
    15:45:08 ==> default: changed: [localhost]
    15:45:08 ==> default:
    15:45:08 ==> default: PLAY RECAP
    15:45:08 ==> default: localhost : ok=15 changed=11 unreachable=0 failed=0
    15:45:08 ==> default: ++ '[' 0 -ne 0 ']'
    15:45:08 ==> default: ++ cat /root/iscsi-initiator-utils/artifacts/test.log
    15:45:08 ==> default: PASS iscsiadm_iface

Tests will be enabled in CI, yet gating is currently disabled, so nothing will change. However eventually gating will be enabled. Tests will run on each dist-git commit, they are not triggered on koji builds and if you are using FMN, it should notify you of failures normally.

The RH QE maintainer contact in case you have questions: mhoyer@redhat.com
The idea is that these tests become yours just as you're maintaining the package, there will of course be people around if you have questions or troubles.

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

Hello, just following up to see if there is any additional information I can provide to help move this along ? Thanks!