#6 Add CI tests using the standard test interface
Closed 5 years ago by dmach. Opened 5 years ago by esakaiev.
git://fedorapeople.org/~esakaiev/dnf new_tests1  into  master

Adding tests from upstreamfirst to the new_tests1 branch
esakaiev • 5 years ago  
tests/basic-sanity/Makefile
file added
+63
@@ -0,0 +1,63 @@

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

+ #

+ #   Makefile of /CoreOS/dnf/Sanity/basic-sanity

+ #   Description: basic sanity test

+ #   Author: Eva Mrakova <emrakova@redhat.com>

+ #

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

+ #

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

+ #

+ #   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 2 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/.

+ #

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

+ 

+ export TEST=/CoreOS/dnf/Sanity/basic-sanity

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

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

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	test -x runtest.sh || chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

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

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Eva Mrakova <emrakova@redhat.com>" > $(METADATA)

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

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

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

+ 	@echo "Description:     basic sanity test" >> $(METADATA)

+ 	@echo "Type:            Sanity" >> $(METADATA)

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

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

+ 	@echo "Requires:        dnf createrepo_c httpd rpm-build" >> $(METADATA)

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

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

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

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

+ 	@echo "Releases:        -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/basic-sanity/PURPOSE
file added
+3
@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/dnf/Sanity/basic-sanity

+ Description: basic sanity test

+ Author: Eva Mrakova <emrakova@redhat.com>

tests/basic-sanity/runtest.sh
file added
+164
@@ -0,0 +1,164 @@

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/dnf/Sanity/basic-sanity

+ #   Description: basic sanity test

+ #   Author: Eva Mrakova <emrakova@redhat.com>

+ #

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

+ #

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

+ #

+ #   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 2 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 Beaker environment

+ . /usr/bin/rhts-environment.sh || exit 1

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="dnf"

+ 

+ DNF_CMD="dnf --disablerepo=\* --enablerepo=tstrepo\*"

+ 

+ RPMS="/root/rpmbuild/RPMS/noarch"

+ REPO="/var/www/html/tstrepo"

+ 

+ pkgtorepo() {

+     # builds a .rpm from given .spec, moves it to a testrepo identified by index

+     # $1 ... pkgname, $2 ... tstrepo index

+     rpmbuild -bb ${1}.spec &> /dev/null

+     cp $RPMS/${1}*.rpm ${REPO}${2}

+     rm -f $RPMS/${1}*.rpm

+ }

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlFileBackup --clean /etc/yum.repos.d/ /var/log/httpd/

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+         rlRun "cp *.spec $TmpDir"

+         rlRun "pushd $TmpDir"

+         for i in {1..2}; do

+             rlRun "mkdir $REPO$i" 0 "Create dir for tstrepo$i"

+             cat > /etc/yum.repos.d/tstrepo${i}.repo <<EOF

+ [tstrepo$i]

+ name=tstrepo$i

+ baseurl=http://localhost/tstrepo$i/

+ enabled=1

+ gpgcheck=0

+ EOF

+         done

+         pkgtorepo testA 1

+         rlRun "createrepo_c ${REPO}1" 0 "Create tstrepo1"

+         rlRun "createrepo_c ${REPO}2" 0 "Create tstrepo2"

+ 

+         # workaround: when /var/log/httpd does not exist, httpd fails to start

+         if [[ ! -d /var/log/httpd ]]; then mkdir -p /var/log/httpd; fi 

+         rlServiceStart httpd

+     rlPhaseEnd

+ 

+     rlPhaseStartTest "Install, upgrade, downgrade and remove a pkg without dependencies"

+         # install a single pkg

+         rlRun "$DNF_CMD -y install testA" 0 "Install testA"

+         rlAssertRpm testA 1

+         # upgrade the pkg

+         rlRun "sed -i 's/Version.*$/Version: 2/' testA.spec"

+         pkgtorepo testA 2

+         rlRun "createrepo_c ${REPO}2" 0 "Update tstrepo2"

+         rlRun "$DNF_CMD clean all" 0 "Clean dnf cache"

+         rlRun "$DNF_CMD -y upgrade testA" 0 "Upgrade testA"

+         rlAssertRpm testA 2

+         # downgrade the pkg

+         rlRun "$DNF_CMD -y downgrade testA" 0 "Downgrade testA"

+         rlAssertRpm testA 1

+         # remove the pkg

+         rlRun "$DNF_CMD -y remove testA" 0 "Remove testA"

+         rlAssertNotRpm testA

+     rlPhaseEnd

+ 

+     rlPhaseStartTest "Install and remove a pkg with dependencies"

+         # prepare data

+         pkgtorepo testB 2

+         pkgtorepo testC 2

+         rlRun "createrepo_c ${REPO}2" 0 "Update tstrepo2"

+         rlRun "$DNF_CMD clean all" 0 "Clean dnf cache"

+         # install a pkg (B depends on C, C depends on A)

+         rlRun "$DNF_CMD -y install testB" 0 "Install testB and its deps"

+         rlAssertRpm testB 1

+         rlAssertRpm testC 1

+         rlAssertRpm testA 2

+         # remove the pkg (C and B should be removed)

+         rlRun "$DNF_CMD -y --setopt clean_requirements_on_remove=0 remove testC" 0 "Remove testC"

+         rlAssertNotRpm testC

+         rlAssertNotRpm testB

+         # testA should not be removed as an unused dep

+         rlAssertRpm testA 2

+     rlPhaseEnd

+ 

+     rlPhaseStartTest "Getting info (list, info, search, provides, whatprovides)"

+         # list

+         rlRun "$DNF_CMD list installed test\* > list1.out" 0 "Run dnf list installed"

+         rlAssertGrep "testA.*noarch" list1.out

+         rlAssertNotGrep "testB.*noarch" list1.out

+         rlAssertNotGrep "testC.*noarch" list1.out

+         rlRun "$DNF_CMD list available test\* > list2.out" 0 "Run dnf list available"

+         rlAssertGrep "testB.*noarch" list2.out

+         rlAssertGrep "testC.*noarch" list2.out

+         rlAssertNotGrep "testA.*noarch" list2.out

+         rlRun "$DNF_CMD -y downgrade testA" 0 "Downgrade testA"

+         rlRun "$DNF_CMD list upgrades > list3.out" 0 "Run dnf list upgrades"

+         rlAssertGrep "testA.*noarch.*tstrepo2" list3.out

+         # info

+         rlRun "$DNF_CMD info test[B-Z] > info.out" 0 "Run dnf info"

+         rlAssertGrep "Name.*testB" info.out

+         rlAssertGrep "Name.*testC" info.out

+         rlAssertNotGrep "Name.*testA" info.out

+         # search

+         rlRun "$DNF_CMD search 'This is a testB' > search.out" 0 "Run dnf search"

+         rlAssertGrep "Matched: This is a testB" search.out

+         rlAssertGrep "testB.*noarch" search.out

+         # provides

+         rlRun "$DNF_CMD provides testC-provides > provides.out" 0 "Run dnf provides"

+         rlAssertGrep "testC.*noarch" provides.out

+         # whatprovides

+         rlRun "$DNF_CMD whatprovides '/usr/bin/testA' > provides2.out" 0 "Run dnf whatprovides"

+         rlAssertGrep "testA-1.*noarch" provides2.out

+         rlAssertGrep "testA-2.*noarch" provides2.out

+     rlPhaseEnd

+ 

+     rlPhaseStartTest "History (list, info, undo, redo)"

+         rlRun "$DNF_CMD history list > hist1.out" 0 "Run dnf history list"

+         rlAssertGrep "Downgrade" hist1.out

+         # last transaction was testA downgrade, let's get its ID

+         rlRun "$DNF_CMD history info > hist2.out" 0 "Run dnf history info"

+         DOWNGRADE_HIST_ID=$(grep 'Transaction ID' hist2.out | cut -d: -f2)

+         rlRun "$DNF_CMD -y history undo last" 0 "Run dnf history undo"

+         rlAssertRpm testA 2

+         rlRun "$DNF_CMD -y history redo $DOWNGRADE_HIST_ID" 0 "Run dnf history redo"

+         rlAssertRpm testA 1

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "$DNF_CMD -y remove testA"

+         rlRun "rm -rf /var/www/html/tstrepo{1,2}" 0 "Delete tstrepo dirs"

+         rlRun "$DNF_CMD clean all" 0 "Clean dnf cache"

+         rlFileRestore

+         rlServiceRestore httpd

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Remove tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/basic-sanity/testA.spec
file added
+21
@@ -0,0 +1,21 @@

+ Summary: testA Package

+ Name: testA

+ Version: 1

+ Release: 0

+ Group: System Environment/Base

+ License: GPL

+ BuildArch: noarch

+ BuildRoot:  %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

+ 

+ %description

+ 

+ This is a testA test package

+ 

+ %build

+ 

+ %install

+ mkdir -p %{buildroot}/usr/bin/

+ touch %{buildroot}/usr/bin/testA

+ 

+ %files

+ /usr/bin/testA

tests/basic-sanity/testB.spec
file added
+23
@@ -0,0 +1,23 @@

+ Summary: testB Package

+ Name: testB

+ Version: 1

+ Release: 0

+ Group: System Environment/Base

+ License: GPL

+ BuildArch: noarch

+ BuildRoot:  %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

+ Provides: testB-provides

+ Requires: testC

+ 

+ %description

+ 

+ This is a testB test package

+ 

+ %build

+ 

+ %install

+ mkdir -p %{buildroot}/usr/bin/

+ touch %{buildroot}/usr/bin/testB

+ 

+ %files

+ /usr/bin/testB

tests/basic-sanity/testC.spec
file added
+23
@@ -0,0 +1,23 @@

+ Summary: testC Package

+ Name: testC

+ Version: 1

+ Release: 0

+ Group: System Environment/Base

+ License: GPL

+ BuildArch: noarch

+ BuildRoot:  %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

+ Provides: testC-provides

+ Requires: testA

+ 

+ %description

+ 

+ This is a testC test package

+ 

+ %build

+ 

+ %install

+ mkdir -p %{buildroot}/usr/bin/

+ touch %{buildroot}/usr/bin/testC

+ 

+ %files

+ /usr/bin/testC

tests/behave_tests/Dockerfile
file added
+72
@@ -0,0 +1,72 @@

+ FROM fedora:26

+ ENV LANG C

+ ARG type=local

+ 

+ COPY dnf-docker-test/repo /var/www/html/repo/

+ COPY dnf-docker-test/features /behave/

+ COPY dnf-docker-test/features /tests/

+ COPY dnf-docker-test/x509certgen /usr/local/bin

+ 

+ RUN set -x && \

+     echo -e "deltarpm=0\ntsflags=nodocs" >> /etc/dnf/dnf.conf && \

+     # httpd:        http-style repos

+     # vsftpd:       ftp-style repos

+     # behave:       core

+     # six:          py2/py3

+     # enum34:       enum for py2, rpmdb.State

+     # whichcraft:   shutil.which() for py2

+     # jinja2:       rpmspec template

+     # pexpect:      shell tests_list

+     # rpm-build:    building dummy RPMs

+     # openssl:      generating TLS certificates

+     # mod_ssl:      https-style repos

+     # gnupg2:       GPG keys

+     # rng-tools:    to generate enough _random_ data for GPG keys

+     # rpm-sign:     rpm signing

+     # createrepo_c: building repos

+     dnf -y install httpd vsftpd python2-behave python2-six python-enum34 python2-whichcraft python-jinja2 python2-pexpect rpm-build openssl mod_ssl gnupg2 rng-tools rpm-sign createrepo_c && \

+     if [ $type = "local" ]; then \

+         # Allows to run test with rpms from only single component in rpms/

+         dnf -y install dnf-plugins-core python3-dnf-plugins-core python2-dnf-plugins-core createrepo_c && \

+         dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \

+     fi && \

+     # prevent installation of dnf-plugins-extras (versionlock, local, torproxy)

+     rm -vf /rpms/*dnf-plugin-versionlock*.rpm /rpms/*dnf-plugin-local*.rpm /rpms/*dnf-plugin-torproxy*.rpm && \

+     # update dnf

+     dnf -y --best upgrade dnf && \

+     if [ $type = "local" ]; then \

+         # install all rpms if present

+         if ls /rpms/*.rpm 1>/dev/null 2>&1; then dnf -y --skip-broken install /rpms/*.rpm; fi && \

+         # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1398272

+         rpm -q dnf && \

+         # some unknown thing

+         dnf -q repoquery --unneeded | xargs --no-run-if-empty dnf mark install; \

+     else \

+         dnf -y install /rpms/*.rpm && \

+         dnf -y autoremove; \

+     fi && \

+     # generate certificates that will be used for the testing purposes

+     /usr/local/bin/x509certgen x509KeyGen ca && \

+     /usr/local/bin/x509certgen x509KeyGen server && \

+     /usr/local/bin/x509certgen x509KeyGen client && \

+     /usr/local/bin/x509certgen x509KeyGen ca2 && \

+     /usr/local/bin/x509certgen x509KeyGen server2 && \

+     /usr/local/bin/x509certgen x509KeyGen client2 && \

+     /usr/local/bin/x509certgen x509SelfSign -t ca ca && \

+     /usr/local/bin/x509certgen x509SelfSign -t ca ca2 && \

+     /usr/local/bin/x509certgen x509CertSign -t webserver --CA ca server && \

+     /usr/local/bin/x509certgen x509CertSign -t webclient --CA ca client && \

+     /usr/local/bin/x509certgen x509CertSign -t webserver --CA ca2 server2 && \

+     /usr/local/bin/x509certgen x509CertSign -t webclient --CA ca2 client2 && \

+     # configure httpd

+     #sed -i "s/#ServerName .*/ServerName ${HOSTNAME}:80/" /etc/httpd/conf/httpd.conf && \

+     sed -i 's:^SSLCertificateFile .*:SSLCertificateFile /etc/pki/tls/certs/testcerts/server/cert.pem:' /etc/httpd/conf.d/ssl.conf && \

+     sed -i 's:^SSLCertificateKeyFile .*:SSLCertificateKeyFile /etc/pki/tls/certs/testcerts/server/key.pem:' /etc/httpd/conf.d/ssl.conf && \

+     sed -i 's:.*SSLCACertificateFile .*:SSLCACertificateFile /etc/pki/tls/certs/testcerts/ca/cert.pem:' /etc/httpd/conf.d/ssl.conf && \

+     dnf -y clean all && \

+     mkdir /tmp/repos.d && mv /etc/yum.repos.d/* /tmp/repos.d/ && \

+     mkdir /repo && \

+     rm -f /behave/*.feature

+ 

+ ADD dnf-docker-test/launch-test /usr/bin/

+ VOLUME ["/junit"]

tests/behave_tests/README.md
file added
+152
@@ -0,0 +1,152 @@

+ ci-dnf-stack

+ ============

+ 

+ ci-dnf-stack is a set of configuration and scripts that allow continuous

+ integrations DNF (https://github.com/rpm-software-management/dnf) stack.

+ 

+ This serves as an ad hoc solution to where to store routines that belong

+ to all the components of the stack. It would be nice to merge them into

+ the respective components.

+ 

+ These scripts are free and open-source software; see the section License

+ to understand the terms and conditions under which you can use, study,

+ modify and distribute ci-dnf-stack.

+ 

+ Dnf Docker Test in ci-dnf-stack

+ -------------------------------

+ 

+ The project originated from richdeps-docker (https://github.com/shaded-enmity/richdeps-docker).

+ Docker image for testing rich dependencies and CLI in DNF/RPM

+ using the Behave framework. The project was optimized for incorporation to

+ ci-dnf-stack as a module.

+ Each test runs in it's own container making it possible to run multiple tests

+ in parallel without interfering with each other. These tests are meant to

+ verify that both DNF and RPM (if relevant) interpret the rich dependency semantics

+ correctly and all functionality of DNF and related component is intact. Dnf Docker

+ Test use its own feature files and steps descriptions placed in its directory

+ (dnf-docker-test/).

+ 

+ License

+ -------

+ 

+ The project is licensed under the copyleft GNU General Public License;

+ either version 2, or (at your option) any later version. See the

+ LICENSE file found in the top-level directory of this distribution and

+ at https://github.com/rpm-software-management/ci-dnf-stack/. No part of

+ ci-dnf-stack, including this file, may be copied, modified, propagated,

+ or distributed except according to the terms contained in the LICENSE

+ file.

+ 

+ Requirements

+ ------------

+ 

+ * python

+ * python3 >= 3.5

+ * jenkins

+ * docker

+ * git-core

+ * /usr/bin/rpmbuild

+ * docker

+ * jq

+ 

+ For building in COPR:

+ * python3-copr

+ * python3-beautifulsoup4

+ * python3-requests

+ 

+ sudo should be configured for `jenkins` user to use `docker`:

+ ```

+ # cat << EOF > /etc/sudoers.d/99-jenkins

+ jenkins ALL=(ALL) NOPASSWD: /usr/bin/docker

+ EOF

+ ```

+ 

+ To rebuild `test-1` or `upgrade_1` repository for Dnf Docker Test run

+ `test-1.py` or `upgrade_1.py` in `dnf-docker-test/repo_create directory`.

+ It requires following components:

+ * python3-rpmfluff

+ 

+ Configuring Jenkins

+ -------------------

+ 

+ We are using [jenkins-job-builder](http://docs.openstack.org/infra/jenkins-job-builder/)

+ to manage jenkins jobs.

+ 

+ To deploy jobs you need configure your [jenkins_jobs.ini](http://docs.openstack.org/infra/jenkins-job-builder/execution.html)

+ and run `jenkins-jobs --config=/path/to/jenkins_jobs.ini update jobs/`.

+ 

+ Local run

+ ---------

+ 

+ Local test can be performed with dnf-testing.sh

+ * Container build:

+ ** Put your RPMs into "dnf-docker-test/rpms" directory

+ ** Then run ``dnf-testing.sh build``

+ * Run tests

+ ** Run all tests with last built container use command ``./dnf-testing.sh run``

+ ** Run all tests with specified container use command``./dnf-testing.sh run -c <CONTAINER>``

+ ** Run particular tests run: ``./dnf-testing.sh run TEST-A TEST-B ...``

+ * Run in devel mode

+ ** It shares local feature dir with description of tests and test steps with docker image, therefore you can develop CI stack on fly.

+ ** Use command ``./dnf-testing.sh run --devel $CONTAINER TEST-A``

+ * Get help

+ ** ./dnf-testing.sh --help

+ 

+ 

+ Describing a test

+ -----------------

+ 

+ Here's an example configuration from the first ported test:

+ 

+ ```

+ Feature: Install package with dependency

+ 

+     @setup

+     Scenario: Feature setup

+         Given repository "test" with packages

+            | Package | Tag      | Value |

+            | TestA   | Requires | TestB |

+            | TestB   |          |       |

+ 

+     Scenario: Install TestA from repository "test" with dependency TestB

+          When I save rpmdb

+           And I enable repository "test"

+           And I successfully run "dnf install -y TestA" with "success"

+          Then rpmdb changes are

+            | State     | Packages     |

+            | installed | TestA, TestB |

+ ```

+ 

+ Possible states: installed, removed, absent, unchanged, reinstalled, updated, downgraded.

+ The states unchanged and absent can be used

+ for detailed description of tested step or to ensure, that required conditions before or after tested step were met.

+ 

+ Support

+ -------

+ 

+ If you are having issues, please report them via the issue tracking

+ system.

+ 

+ - issue tracker: https://github.com/rpm-software-management/ci-dnf-stack/issues

+ 

+ Notes for functional testing

+ ----------------------------

+ 

+ Repo upgrade_1:

+ updateinfo.xml was added using modifyrepo_c updateinfo.xml path/upgrade_1/repodata/

+ 

+ Repo test-1-gpg:

+ Was created from rpms in test-1 repo. All rpm were signed with gpg-pubkey-2d2e7ca3-56c1e69d	gpg(DNF Test1 (TESTER)

+ <dnf@testteam.org>) except TestE (not signed), TestG (signed with key gpg-pubkey-705f3e8c-56c2e298	gpg(DNF Test2

+ (TESTER) <dnf@testteam.org>)), and TestJ (not signed and incorrect check-sum).

+ 

+ Repo upgrade_1-gpg:

+ Was created from rpms in upgrade_1 repo. All rpm were signed with gpg-pubkey-705f3e8c-56c2e298	gpg(DNF Test2

+ (TESTER) <dnf@testteam.org>) except both TestE (not signed) packages.

+ 

+ Contributions

+ -------------

+ 

+ Any contribution or feedback is more than welcome.

+ 

+ - version control system: https://github.com/rpm-software-management/ci-dnf-stack

tests/behave_tests/dnf-docker-test/README.md
file added
+19
@@ -0,0 +1,19 @@

+ Generate documentation

+ ----------------------

+ 

+ Following packages (or their python2 equivalents) should be installed:

+   python3-behave python3-sphinx python3-whichcraft python3-pexpect

+ 

+ ```

+ $ rm -vf doc/*.rst

+ $ behave-3 -q --dry-run -f sphinx.steps -o doc/

+ $ sphinx-build-3 -W -b html doc/ doc/_build/

+ ```

+ 

+ respectively

+ 

+ ```

+ $ rm -vf doc/*.rst

+ $ behave-2 -q --dry-run -f sphinx.steps -o doc/

+ $ sphinx-build-2 -W -b html doc/ doc/_build/

+ ```

tests/behave_tests/dnf-docker-test/features/autoremove.feature
file added
+32
@@ -0,0 +1,32 @@

+ Feature: Autoremoval of unneeded packages

+ 

+   @setup

+   Scenario: Feature Setup

+       Given repository "base" with packages

+          | Package | Tag         | Value |

+          | TestA   | Requires    | TestB |

+          | TestB   | Recommends  | TestC |

+          | TestC   |             |       |

+          | TestD   | Supplements | TestC |

+         And repository "updates" with packages

+          | Package | Tag         | Value |

+          | TestA   | Release     | 2     |

+        When I save rpmdb

+         And I enable repository "base"

+         And I successfully run "dnf -y install TestA"

+        Then rpmdb changes are

+          | State     | Packages                   |

+          | installed | TestA, TestB, TestC, TestD |

+ 

+   Scenario: Autoremoval of package which became non-required by others

+        When I save rpmdb

+         And I enable repository "updates"

+         And I successfully run "dnf -y update"

+        Then rpmdb changes are

+          | State     | Packages            |

+          | upgraded  | TestA               |

+        When I save rpmdb

+         And I successfully run "dnf -y autoremove"

+        Then rpmdb changes are

+          | State     | Packages            |

+          | removed   | TestB, TestC, TestD |

tests/behave_tests/dnf-docker-test/features/builddep.feature
file added
+78
@@ -0,0 +1,78 @@

+ Feature: Builddep

+ 

+   @setup

+   Scenario: Feature Setup

+       Given enabled repository "available" with packages

+          | Package | Tag      | Value            |

+          | TestA   |          |                  |

+          | TestB   |          |                  |

+          | TestC   |          |                  |

+          | TestD   |          |                  |

+          | TestE   |          |                  |

+          | TestF   | Provides | /usr/bin/TestXXX |

+         And a file "/tmp/test.spec" with

+             """

+             Name:          test

+             Version:       1

+             Release:       1

+             Summary:       Test

+ 

+             License:       Public Domain

+             URL:           http://localhost

+ 

+             BuildRequires: %{?buildrequires}%{?!buildrequires:TestA}

+             BuildArch:     noarch

+ 

+             %description

+             %{summary}.

+ 

+             %prep

+             %autosetup -c -D -T

+             """

+ 

+   Scenario: Builddep with simple dependency (spec)

+        When I save rpmdb

+         And I successfully run "dnf -y builddep /tmp/test.spec"

+        Then rpmdb changes are

+          | State     | Packages |

+          | installed | TestA    |

+ 

+   Scenario: Builddep with simple dependency (spec) + define

+        When I save rpmdb

+         And I successfully run "dnf -y builddep /tmp/test.spec --define 'buildrequires TestB'"

+        Then rpmdb changes are

+          | State     | Packages |

+          | installed | TestB    |

+ 

+   Scenario: Builddep with simple dependency (srpm)

+        When I successfully run "rpmbuild -D '_srcrpmdir /tmp' -D 'buildrequires TestC' -bs /tmp/test.spec"

+        When I save rpmdb

+         And I successfully run "dnf -y builddep /tmp/test-1-1.src.rpm"

+        Then rpmdb changes are

+          | State     | Packages |

+          | installed | TestC    |

+ 

+   Scenario: Builddep with rich dependency

+        When I save rpmdb

+         And I successfully run "dnf -y builddep /tmp/test.spec --define 'buildrequires (TestD and TestE)'"

+        Then rpmdb changes are

+          | State     | Packages     |

+          | installed | TestD, TestE |

+ 

+   Scenario: Builddep with simple dependency (files-like provide)

+        When I save rpmdb

+         And I successfully run "dnf -y builddep /tmp/test.spec --define 'buildrequires /usr/bin/TestXXX'"

+        Then rpmdb changes are

+          | State     | Packages |

+          | installed | TestF    |

+ 

+   Scenario: Builddep with simple dependency (non-existent)

+        When I run "dnf -y builddep /tmp/test.spec --define 'buildrequires TestX = 1'"

+        Then the command should fail

+         And the command stderr should match exactly

+             """

+             No matching package to install: 'TestX = 1'

+             Not all dependencies satisfied

+             Error: Some packages could not be found.

+ 

+             """

tests/behave_tests/dnf-docker-test/features/check-1.feature
file added
+51
@@ -0,0 +1,51 @@

+ Feature: Test for dnf check --duplicates command

+ 

+   Scenario: Install package in version 1

+       Given repository "base" with packages

+          | Package      | Tag       | Value        |

+          | TestA        | Version   | 1            |

+        When I save rpmdb

+         And I enable repository "base"

+         And I successfully run "dnf -y install TestA"

+        Then rpmdb changes are

+          | State     | Packages       |

+          | installed | TestA          |

+        When I successfully run "dnf check"

+        Then the command stdout should be empty

+         And the command stderr should be empty

+ 

+   Scenario: Install package in version 2 and check for duplicates

+       Given repository "base2" with packages

+          | Package      | Tag       | Value        |

+          | TestA        | Version   | 2            |

+        When I enable repository "base2"

+         And I successfully run "rpm -i TestA*.rpm" in repository "base2"

+        Then the command should pass

+        When I run "dnf check"

+        Then the command should fail

+         And the command stdout should match regexp "TestA.* is a duplicate with TestA-2.*"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --duplicates"

+        Then the command should fail

+         And the command stdout should match regexp "TestA.* is a duplicate with TestA-2.*"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --dependencies"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --obsoleted"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --provides"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

tests/behave_tests/dnf-docker-test/features/check-2.feature
file added
+84
@@ -0,0 +1,84 @@

+ Feature: Test for check --dependencies command

+ 

+   @setup

+   Scenario: Prepare "base" repository with test packages

+       Given repository "base" with packages

+          | Package      | Tag       | Value        |

+          | TestA        | Requires  | TestB        |

+          |              | Conflicts | TestC        |

+          | TestB        |           |              |

+          | TestC        |           |              |

+ 

+   Scenario: Force installation of package with broken dependencies

+        When I enable repository "base"

+         And I successfully run "rpm -i --nodeps TestA*.rpm" in repository "base"

+        Then the command should pass

+        When I run "dnf check"

+        Then the command should fail

+         And the command stdout should match regexp "TestA-1.* has missing requires of TestB"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --dependencies"

+        Then the command should fail

+         And the command stdout should match regexp "TestA-1.* has missing requires of TestB"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --duplicates"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --obsoleted"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --provides"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+ 

+   Scenario: Fulfill the missing dependencies

+        When I enable repository "base"

+         And I successfully run "dnf -y install TestB"

+        When I run "dnf check"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+ 

+   Scenario: Force installation of conflicting package

+        When I enable repository "base"

+         And I successfully run "rpm -i --nodeps TestC*.rpm" in repository "base"

+        Then the command should pass

+        When I run "dnf check"

+        Then the command should fail

+         And the command stdout should match regexp "TestA-1.* has installed conflict "TestC": TestC-1.*"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --dependencies"

+        Then the command should fail

+         And the command stdout should match regexp "TestA-1.* has installed conflict "TestC": TestC-1.*"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --duplicates"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --obsoleted"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --provides"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

tests/behave_tests/dnf-docker-test/features/check-3.feature
file added
+46
@@ -0,0 +1,46 @@

+ Feature: Test for dnf check --obsoleted command

+ 

+   Scenario: Force install package that obsoletes already installed package

+       Given repository "base" with packages

+          | Package      | Tag       | Value        |

+          | TestA        |           |              |

+          | TestB        | Obsoletes | TestA        |

+        When I enable repository "base"

+         And I successfully run "rpm -i --nodeps TestA*.rpm" in repository "base"

+        Then the command should pass

+        When I run "dnf check"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I successfully run "rpm -i --nodeps TestB*.rpm" in repository "base"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check"

+        Then the command should fail

+         And the command stdout should match regexp "TestA-1.* is obsoleted by TestB-1.*"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --obsoleted"

+        Then the command should fail

+         And the command stdout should match regexp "TestA-1.* is obsoleted by TestB-1.*"

+         And the command stderr should match exactly

+             """

+             Error: Check discovered 1 problem(s)

+ 

+             """

+        When I run "dnf check --duplicates"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --dependencies"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

+        When I run "dnf check --provides"

+        Then the command should pass

+         And the command stdout should be empty

+         And the command stderr should be empty

tests/behave_tests/dnf-docker-test/features/clean-1.feature
file added
+20
@@ -0,0 +1,20 @@

+ Feature: DNF/Behave test (clean - host)

+ 

+ Scenario: Ensure that metadata are unavailable after "dnf clean all"

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/etc/yum.repos.d/test-1.repo" with content: "[test-1]\nname=test-1\nbaseurl=file:///var/www/html/repo/test-1\nenabled=1\ngpgcheck=0\nskip_if_unavailable=False"

+   When _deprecated I execute "dnf" command "makecache" with "success"

+   Then _deprecated I execute "dnf" command "-y -C install TestB" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | installed    | TestB      |

+   When _deprecated I execute "dnf" command "clean all" with "success"

+   Then _deprecated I execute "dnf" command "-y -C install TestC" with "fail"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | absent       | TestC      |

+   # Cleaning after scenario

+   When _deprecated I execute "dnf" command "-y remove TestB" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | removed      | TestB      |

tests/behave_tests/dnf-docker-test/features/clean-2.feature
file added
+11
@@ -0,0 +1,11 @@

+ Feature: DNF/Behave test (clean - installroot)

+ 

+ Scenario: Ensure that metadata are unavailable after "dnf --installroot=path clean all"

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/dockertesting1/etc/yum.repos.d/test-1.repo" with content: "[test-1]\nname=test-1\nbaseurl=file:///var/www/html/repo/test-1\nenabled=1\ngpgcheck=0\nskip_if_unavailable=False"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting1 makecache" with "success"

+   Then _deprecated I execute "dnf" command "--installroot=/dockertesting1 -y -C install TestB" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting1 TestB" with "success"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting1 clean all" with "success"

+   Then _deprecated I execute "dnf" command "--installroot=/dockertesting1 -y -C install TestC" with "fail"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting1 TestC" with "fail"

tests/behave_tests/dnf-docker-test/features/clean-requirements-on-remove.feature
file added
+33
@@ -0,0 +1,33 @@

+ Feature: Removal of package with clean_requirements_on_remove

+ 

+   @setup

+   Scenario: Feature Setup

+       Given enabled repository "available" with packages

+          | Package | Tag      | Value  |

+          | TestA   | Requires | TestB  |

+          | TestB   |          |        |

+ 

+   Scenario: Remove with --setopt=clean_requirements_on_remove=True

+        When I save rpmdb

+         And I successfully run "dnf -y install TestA"

+        Then rpmdb changes are

+          | State     | Packages     |

+          | installed | TestA, TestB |

+        When I save rpmdb

+         And I successfully run "dnf --setopt=clean_requirements_on_remove=True -y remove TestA"

+        Then rpmdb changes are

+          | State     | Packages     |

+          | removed   | TestA, TestB |

+ 

+   Scenario: Remove with --setopt=clean_requirements_on_remove=False

+        When I save rpmdb

+         And I successfully run "dnf -y install TestA"

+        Then rpmdb changes are

+          | State     | Packages     |

+          | installed | TestA, TestB |

+        When I save rpmdb

+         And I successfully run "dnf --setopt=clean_requirements_on_remove=False -y remove TestA"

+        Then rpmdb changes are

+          | State     | Packages     |

+          | removed   | TestA        |

+          | unchanged | TestB        |

tests/behave_tests/dnf-docker-test/features/config-1.feature
file added
+15
@@ -0,0 +1,15 @@

+ Feature: DNF/Behave test (DNF config and config files in installroot)

+ 

+ Scenario: Reposdir option in dnf.conf file with --config option in installroot if it correctly taken first from installroot then from host

+   Given _deprecated I use the repository "upgrade_1"

+   When _deprecated I create a file "/dnf/dnf.conf" with content: "[main]\nreposdir=/var/www/html/repo/test-1-gpg,/testdir"

+   When _deprecated I execute "bash" command "mkdir -p  /dockertesting2/testdir" with "success"

+   Then _deprecated the path "/dockertesting2/testdir/" should be "present"

+   # It shoud fail due to lo repository in /dockertesting2/testdir (If dir in installroot, only from installroot reposdirs)

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting2 -c /dnf/dnf.conf -y install TestC" with "fail"

+   When _deprecated I execute "bash" command "rm -rf  /dockertesting2/testdir" with "success"

+   Then _deprecated the path "/dockertesting2/testdir/" should be "absent"

+   # It give success. Repos is taken from /var/www/html/repo/test-1-gpg (no reposdir in installroot)

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting2 -c /dnf/dnf.conf -y install TestC" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting2 TestC" with "success"

+   Then _deprecated line from "stdout" should "start" with "TestC-1.0.0-1"

tests/behave_tests/dnf-docker-test/features/config.feature
file added
+111
@@ -0,0 +1,111 @@

+ Feature: DNF/Behave test (DNF config and config files in installroot)

+ 

+ Scenario: Create dnf.conf file and test if host is using /etc/dnf/dnf.conf.

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I execute "dnf" command "install -y TestC" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | installed    | TestC      |

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]\nexclude=TestA"

+   When _deprecated I execute "dnf" command "install -y TestA" with "fail"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | absent       | TestA, TestB  |

+   # Cleaning traces from scenario - dnf.conf with only main section

+   When _deprecated I execute "dnf" command "remove -y TestC" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | removed      | TestC      |

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]"

+ 

+ Scenario: Test removal of depemdency when clean_requirements_on_remove=false

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]\nexclude=TestA\nclean_requirements_on_remove=false"

+   When _deprecated I execute "dnf" command "install -y --disableexcludes=main TestA" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestA, TestB  |

+   When _deprecated I execute "dnf" command "remove -y --disableexcludes=all TestA" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | removed      | TestA      |

+   When _deprecated I execute "dnf" command "remove -y TestB" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | removed      | TestB      |

+   # Cleaning traces from scenario - dnf.conf with only main section

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]"

+ 

+ Scenario: Create dnf.conf file and test if host is taking option -c /test/dnf.conf file (absolute and relative path)

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]\nexclude=TestA\nclean_requirements_on_remove=false"

+   When _deprecated I create a file "/test/dnf.conf" with content: "[main]\nexclude=TestD\nclean_requirements_on_remove=true"

+   When _deprecated I execute "dnf" command "install -y -c /test/dnf.conf TestA" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestA, TestB  |

+   When _deprecated I execute "dnf" command "install -y -c /test/dnf.conf TestD" with "fail"

+   When _deprecated I execute "dnf" command "install -y --config test/dnf.conf TestD" with "fail"

+ # TestA cannot be removed due to host exclude in dnf.conf

+   When _deprecated I execute "dnf" command "remove -y TestA" with "fail"

+ # TestB can be removed because excludes were disabled

+   When _deprecated I execute "dnf" command "remove -y --disableexcludes=all TestB" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | removed      | TestA, TestB  |

+ 

+ Scenario: Test without dnf.conf in installroot (dnf.conf is not taken from host)

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/test/dnf.conf" with content: "[main]\nexclude=TestD\nclean_requirements_on_remove=true"

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]\nexclude=TestA\nclean_requirements_on_remove=true"

+   When _deprecated I execute "dnf" command "config-manager --setopt=reposdir=/dockertesting/etc/yum.repos.d --add-repo /etc/yum.repos.d/test-1.repo" with "success"

+   Then _deprecated the path "/dockertesting/etc/yum.repos.d/test-1.repo" should be "present"

+   And _deprecated the path "/dockertesting/etc/dnf/dnf.conf" should be "absent"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting -y install TestA" with "fail"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestA" with "fail"

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]\nclean_requirements_on_remove=true"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting -y install TestA" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestA" with "success"

+   Then _deprecated line from "stdout" should "start" with "TestA-1.0.0-1."

+ 

+ Scenario: Test with dnf.conf in installroot (dnf.conf is taken from installroot)

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/dockertesting/etc/dnf/dnf.conf" with content: "[main]\nexclude=TestE"

+   Then _deprecated the path "/dockertesting/etc/dnf/dnf.conf" should be "present"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting -y install TestE" with "fail"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestE" with "fail"

+ 

+ Scenario: Test with dnf.conf in installroot and --config (dnf.conf is taken from --config)

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/dockertesting/etc/dnf/dnf.conf" with content: "[main]\nexclude=TestE"

+   When _deprecated I create a file "/test/dnf.conf" with content: "[main]\nexclude=TestD\nclean_requirements_on_remove=true"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting -y -c /test/dnf.conf install TestE" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestE" with "success"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting -y -c /test/dnf.conf install TestD" with "fail"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestD" with "fail"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting -y install TestD" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestD" with "success"

+ 

+ Scenario: Reposdir option in dnf conf.file in host

+   Given _deprecated I use the repository "upgrade_1"

+   When _deprecated I create a file "/etc/dnf/dnf.conf" with content: "[main]\nreposdir=/var/www/html/repo/test-1-gpg"

+   When _deprecated I execute "dnf" command "-y install TestN" with "success"

+   Then _deprecated transaction changes are as follows

+    | State        | Packages       |

+    | installed    | TestN-1.0.0-1  |

+ 

+ Scenario: Reposdir option in dnf.conf file in installroot=dockertesting2

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/dockertesting2/etc/dnf/dnf.conf" with content: "[main]\nreposdir=/var/www/html/repo/upgrade_1-gpg"

+   When _deprecated I create a file "/dockertesting2/var/www/html/repo/upgrade_1-gpg/install.repo" with content: "[upgrade_1-gpg-file]\nname=upgrade_1-gpg-file\nbaseurl=http://127.0.0.1/repo/upgrade_1-gpg\nenabled=1\ngpgcheck=1\ngpgkey=file:///var/www/html/repo/upgrade_1-gpg/RPM-GPG-KEY-dtest2"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting2 -y install TestN" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting2 TestN" with "success"

+   Then _deprecated line from "stdout" should "start" with "TestN-1.0.0-4"

+ 

+ Scenario: Reposdir option in dnf.conf file with --config option in installroot=dockertesting2

+   Given _deprecated I use the repository "test-1"

+   When _deprecated I create a file "/dnf/dnf.conf" with content: "[main]\nreposdir=/var/www/html/repo/test-1-gpg"

+   When _deprecated I create a file "/dockertesting2/var/www/html/repo/test-1-gpg/test.repo" with content: "[test]\nname=test\nbaseurl=http://127.0.0.1/repo/test-1-gpg\nenabled=1\ngpgcheck=1\ngpgkey=file:///var/www/html/repo/test-1-gpg/RPM-GPG-KEY-dtest1"

+   When _deprecated I execute "dnf" command "--installroot=/dockertesting2 -c /dnf/dnf.conf -y install TestC" with "success"

+   When _deprecated I execute "bash" command "rpm -q --root=/dockertesting2 TestC" with "success"

+   Then _deprecated line from "stdout" should "start" with "TestC-1.0.0-1"

tests/behave_tests/dnf-docker-test/features/deplist-1.feature
file added
+64
@@ -0,0 +1,64 @@

+ Feature: Deplist as commmand and option

+ 

+   Scenario: Feature Setup

+       Given _deprecated I use the repository "upgrade_1"

+       When I successfully run "dnf makecache"

+ 

+   Scenario: Deplist as command

+        When I successfully run "yum deplist TestA"

+        Then the command stdout should match exactly

+             """

+             package: TestA-1.0.0-1.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             package: TestA-1.0.0-2.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             """

+ 

+   Scenario: Deplist as repoquery option

+        When I successfully run "dnf repoquery --deplist TestA"

+        Then the command stdout should match exactly

+             """

+             package: TestA-1.0.0-1.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             package: TestA-1.0.0-2.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             """

+ 

+   Scenario: Deplist as repoquery option but using dnf bin

+        When I successfully run "sh -c 'dnf repoquery --deplist TestA'"

+        Then the command stdout should match exactly

+             """

+             package: TestA-1.0.0-1.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             package: TestA-1.0.0-2.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             """

+ 

+   Scenario: Deplist with --latest-limit

+        When I successfully run "dnf repoquery --deplist --latest-limit 1 TestA"

+        Then the command stdout should match exactly

+             """

+             package: TestA-1.0.0-2.noarch

+               dependency: TestB

+                provider: TestB-1.0.0-2.noarch

+ 

+             """

+ 

+   Scenario: Deplist with --latest-limit and verbose

+        When _deprecated I execute "dnf" command "repoquery --deplist --latest-limit 1 --verbose TestA" with "success"

+        Then _deprecated line from "stdout" should "start" with "package: TestA-1.0.0-2.noarch"

+        And _deprecated line from "stdout" should "start" with "  dependency: TestB"

+        And _deprecated line from "stdout" should "start" with "   provider: TestB-1.0.0-1.noarch"

+        And _deprecated line from "stdout" should "start" with "   provider: TestB-1.0.0-2.noarch"

tests/behave_tests/dnf-docker-test/features/downgrade-1.feature
file added
+37
@@ -0,0 +1,37 @@

+ Feature: DNF/Behave test (downgrade test)

+ 

+ Scenario: Downgrade TestA from repository "upgrade_1"

+  Given _deprecated I use the repository "upgrade_1"

+  When _deprecated I execute "dnf" command "-y install TestA" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestA, TestB  |

+    | absent       | TestC         |

+  When _deprecated I execute "dnf" command "-y downgrade TestA" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | downgraded   | TestA      |

+    | present      | TestB      |

+    | absent       | TestC      |

+ 

+ Scenario: Downgrade TestD from repository "upgrade_1" that require downgrade of dependency

+  Given _deprecated I use the repository "upgrade_1"

+  When _deprecated I execute "dnf" command "-y install TestD" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestD, TestE  |

+  When _deprecated I execute "dnf" command "-y downgrade TestD" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | downgraded   | TestD, TestE  |

+ 

+ Scenario: Downgrade TestN from repository "upgrade_1" only to previous version

+  Given _deprecated I use the repository "upgrade_1"

+  When _deprecated I execute "dnf" command "-y install TestN" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | installed    | TestN      |

+  When _deprecated I execute "dnf" command "-y downgrade TestN" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages       |

+    | downgraded   | TestN-1.0.0-3  |

tests/behave_tests/dnf-docker-test/features/download-1.feature
file added
+100
@@ -0,0 +1,100 @@

+ Feature: Test for download command, options --destdir, --resolve

+          # --source should be added when there's support for .src.rpm in repos

+ 

+   @setup

+   Scenario: Feature Setup

+       Given http repository "base" with packages

+          | Package  | Tag       | Value  |

+          | TestA    | Version   |  1     |

+          | TestA v2 | Requires  | TestB  |

+          |          | Requires  | TestE  |

+          |          | Version   |  2     |

+          | TestC    | Provides  | TestB  |

+          |          | Conflicts | TestD  |

+          | TestD    | Provides  | TestB  |

+          |          | Conflicts | TestC  |

+          | TestE    |           |        |

+ 

+   Scenario: dnf download (when there is no such pkg)

+        When I run "dnf download TestA"

+        Then the command should fail

+         And the command stderr should match regexp "No package.*available"

+ 

+   Scenario: dnf download (when there is such pkg)

+        When I enable repository "base"

+         And I successfully run "dnf download TestA"

+        Then the command stdout should match regexp "TestA-2.*rpm" 

+         # check that the file has been downloaded into working directory

+         And I successfully run "stat TestA-2-1.noarch.rpm"

+         # check that downloaded .rpm is the same as the one in the repo

+         And I successfully run "bash -c 'diff TestA-2-1.noarch.rpm /var/www/html/tmp*/TestA-2-1.noarch.rpm'"

+ 

+   # check also download --verbose, there were some problems with it 

+   Scenario: dnf download --verbose (when there is such pkg)

+        When I successfully run "rm -f TestA-2-1.noarch.rpm"

+         And I successfully run "dnf download --verbose TestA"

+        Then the command stdout should match regexp "TestA-2.*rpm" 

+         And I successfully run "stat TestA-2-1.noarch.rpm"

+         And I successfully run "bash -c 'diff TestA-2-1.noarch.rpm /var/www/html/tmp*/TestA-2-1.noarch.rpm'"

+ 

+   Scenario: dnf download --resolve (download also dependencies)

+        When I successfully run "dnf download --resolve TestA"

+        Then the command stdout should match regexp "TestC-1.*rpm" 

+         And the command stdout should match regexp "TestE-1.*rpm" 

+         # TestA-2 has already been downloaded, it is not downloaded again

+         And the command stdout should match regexp "SKIPPED.*TestA-2"

+         And I successfully run "stat TestE-1-1.noarch.rpm"

+         And I successfully run "bash -c 'diff TestE-1-1.noarch.rpm /var/www/html/tmp*/TestE-1-1.noarch.rpm'"

+         And I successfully run "stat TestC-1-1.noarch.rpm"

+         And I successfully run "bash -c 'diff TestC-1-1.noarch.rpm /var/www/html/tmp*/TestC-1-1.noarch.rpm'"

+ 

+   Scenario: dnf download --destdir (when there is such pkg)

+        When I successfully run "mkdir -p /tmp/testrpms"

+         And I successfully run "dnf download --destdir /tmp/testrpms TestA"

+        Then the command stdout should match regexp "TestA-2.*rpm" 

+         # check that the file has been downloaded into working directory

+         And I successfully run "stat /tmp/testrpms/TestA-2-1.noarch.rpm"

+         # check that downloaded .rpm is the same as the one in the repo

+         And I successfully run "bash -c 'diff /tmp/testrpms/TestA-2-1.noarch.rpm /var/www/html/tmp*/TestA-2-1.noarch.rpm'"

+ 

+   Scenario: dnf download --destdir --verbose (when there is such pkg)

+        When I successfully run "bash -c 'rm -f /tmp/testrpms/TestA*'"

+         And I successfully run "dnf download --verbose --destdir /tmp/testrpms TestA"

+        Then the command stdout should match regexp "TestA-2.*rpm" 

+         # check that the file has been downloaded into working directory

+         And I successfully run "stat /tmp/testrpms/TestA-2-1.noarch.rpm"

+         # check that downloaded .rpm is the same as the one in the repo

+         And I successfully run "bash -c 'diff /tmp/testrpms/TestA-2-1.noarch.rpm /var/www/html/tmp*/TestA-2-1.noarch.rpm'"

+ 

+   Scenario: dnf download --resolve (download dependencies when some are installed)

+        When I successfully run "bash -c 'rm -f Test*rpm'"

+         And I successfully run "dnf -y install TestE"

+         And I successfully run "dnf download --resolve TestA"

+        Then the command stdout should match regexp "TestA-2.*rpm"

+         And the command stdout should match regexp "TestC-1.*rpm" 

+         And the command stdout should not match regexp "TestE-1.*rpm" 

+         And I successfully run "stat TestA-2-1.noarch.rpm"

+         And I successfully run "bash -c 'diff TestA-2-1.noarch.rpm /var/www/html/tmp*/TestA-2-1.noarch.rpm'"

+         And I successfully run "stat TestC-1-1.noarch.rpm"

+         And I successfully run "bash -c 'diff TestC-1-1.noarch.rpm /var/www/html/tmp*/TestC-1-1.noarch.rpm'"

+        When I run "stat TestE-1-1.noarch.rpm"

+        Then the command should fail

+         # cleanup of downloaded files

+         And I successfully run "bash -c 'rm -f Test*rpm'"

+ 

+   Scenario: dnf download --resolve --destdir (download dependencies when all are installed)

+        When I successfully run "bash -c 'rm -f /tmp/testrpms/Test*rpm'"

+         And I successfully run "dnf -y install TestA"

+         And I successfully run "dnf download --resolve --destdir /tmp/testrpms TestA"

+        # only TestA should be downloaded (no matter that it is installed)

+        Then the command stdout should match regexp "TestA-2.*rpm"

+         And the command stdout should not match regexp "TestC-1.*rpm" 

+         And the command stdout should not match regexp "TestE-1.*rpm" 

+         And I successfully run "stat /tmp/testrpms/TestA-2-1.noarch.rpm"

+         And I successfully run "bash -c 'diff /tmp/testrpms/TestA-2-1.noarch.rpm /var/www/html/tmp*/TestA-2-1.noarch.rpm'"

+        When I run "stat /tmp/testrpms/TestC-1-1.noarch.rpm"

+        Then the command should fail

+        When I run "stat /tmp/testrpms/TestE-1-1.noarch.rpm"

+        Then the command should fail

+         # cleanup of downloaded files and the test dir

+         And I successfully run "bash -c 'rm -rf /tmp/testrpms'"

tests/behave_tests/dnf-docker-test/features/environment.py
file added
+19
@@ -0,0 +1,19 @@

+ import unittest

+ 

+ class dummy(unittest.TestCase):

+     maxDiff = None

+ 

+     def runTest(self):

+         pass

+ 

+ def before_all(ctx):

+     ctx.command_map = {

+         "dnf": ctx.config.userdata.get("dnf_cmd", "dnf")

+     }

+     ctx.rpmdb = None

+     ctx.wipe_rpmdb = False

+     ctx.assertion = dummy()

+ 

+ def after_step(ctx, step):

+     if ctx.wipe_rpmdb:

+         ctx.rpmdb = None

tests/behave_tests/dnf-docker-test/features/gpg-1.feature
file added
+26
@@ -0,0 +1,26 @@

+ Feature: DNF/Behave test (Import GPG-key and test repolist)

+ 

+ Scenario: Add repository to host with gpgcheck=1 from repofile and test 'repolist' command plus dnf.log test

+  Given _deprecated I use the repository "test-1"

+  When _deprecated I execute "dnf" command "repolist" with "success"

+  Then _deprecated line from "stdout" should "not start" with "upgrade_1-gpg"

+  And _deprecated line from "stdout" should "start" with "test-1"

+  When _deprecated I execute "dnf" command "config-manager --add-repo http://127.0.0.1/repo/upgrade_1-gpg/upgrade_1-gpg-file.repo" with "success"

+  When _deprecated I execute "dnf" command "repolist" with "success"

+  Then _deprecated line from "stdout" should "start" with "upgrade_1-gpg-file"

+  And _deprecated line from "stdout" should "start" with "test-1"

+ # It also test if dnf.log file is used from host if package installed in host

+  When _deprecated I execute "bash" command "rm -f /var/log/dnf.log" with "success"

+  Then _deprecated the path "/var/log/dnf.log" should be "absent"

+  When _deprecated I execute "bash" command "rm -f /dockertesting/var/log/dnf.log" with "success"

+  Then _deprecated the path "/dockertesting/var/log/dnf.log" should be "absent"

+ # Test if correct repo is enabled and gpg-key import

+  When _deprecated I execute "dnf" command "-y --disablerepo=* --enablerepo=upgrade_1-gpg-file install TestN" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestN-1.0.0-4 |

+  And _deprecated the path "/dockertesting/var/log/dnf.log" should be "absent"

+  And _deprecated the path "/var/log/dnf.log" should be "present"

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "fail"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "start" with "gpg-pubkey-705f3e8c-56c2e298 --> gpg(DNF Test2 (TESTER) <dnf@testteam.org>)"

tests/behave_tests/dnf-docker-test/features/gpg-2.feature
file added
+21
@@ -0,0 +1,21 @@

+ Feature: DNF/Behave test (GPG key import in installroot)

+ 

+ Scenario: GPG key import after package install from installroot repository into installroot

+  When _deprecated I execute "dnf" command "--setopt=reposdir=/dockertesting/etc/yum.repos.d config-manager --add-repo http://127.0.0.1/repo/test-1-gpg/test-1-gpg-file.repo" with "success"

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "fail"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "not start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+ # It also test if dnf.log file is used from installroot if package installed in installroot

+  When _deprecated I execute "bash" command "rm -f /var/log/dnf.log" with "success"

+  Then _deprecated the path "/var/log/dnf.log" should be "absent"

+  When _deprecated I execute "bash" command "rm -f /dockertesting/var/log/dnf.log" with "success"

+  Then _deprecated the path "/dockertesting/var/log/dnf.log" should be "absent"

+  When _deprecated I execute "dnf" command "--installroot=/dockertesting -y --disablerepo=* --enablerepo=test-1-gpg-file install TestA" with "success"

+  Then _deprecated the path "/dockertesting/var/log/dnf.log" should be "present"

+  When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestA TestB" with "success"

+  Then _deprecated line from "stdout" should "start" with "TestA-1.0.0-1."

+  And _deprecated line from "stdout" should "start" with "TestB-1.0.0-1."

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "not start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

tests/behave_tests/dnf-docker-test/features/gpg-3.feature
file added
+17
@@ -0,0 +1,17 @@

+ Feature: DNF/Behave test (GPG key import in installroot)

+ 

+ Scenario: GPG key import after package install from host repository into installroot

+  When _deprecated I execute "dnf" command "config-manager --add-repo http://127.0.0.1/repo/test-1-gpg/test-1-gpg-file.repo" with "success"

+  When _deprecated I execute "dnf" command "repolist" with "success"

+  Then _deprecated line from "stdout" should "start" with "test-1-gpg-file"

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "fail"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "not start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+  When _deprecated I execute "dnf" command "--installroot=/dockertesting -y --disablerepo=* --enablerepo=test-1-gpg-file install TestA" with "success"

+  When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestA TestB" with "success"

+  Then _deprecated line from "stdout" should "start" with "TestA-1.0.0-1."

+  And _deprecated line from "stdout" should "start" with "TestB-1.0.0-1."

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "not start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

tests/behave_tests/dnf-docker-test/features/gpg-4.feature
file added
+28
@@ -0,0 +1,28 @@

+ Feature: DNF/Behave test (GPG key handing in installroot)

+ 

+ Scenario: Install signed package with signed dependecy with key from host from repository with gpgcheck=1

+ # Install package and import Test2-gpg-key to host

+  When _deprecated I execute "dnf" command "config-manager --add-repo http://127.0.0.1/repo/upgrade_1-gpg/upgrade_1-gpg-file.repo" with "success"

+  When _deprecated I execute "dnf" command "-y install TestN" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestN-1.0.0-4 |

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "fail"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "start" with "gpg-pubkey-705f3e8c-56c2e298 --> gpg(DNF Test2 (TESTER) <dnf@testteam.org>)"

+ # Install package and import Test1-gpg-key to installroot

+  When _deprecated I execute "dnf" command "--setopt=reposdir=/dockertesting/etc/yum.repos.d config-manager --add-repo http://127.0.0.1/repo/test-1-gpg/test-1-gpg-file.repo" with "success"

+  When _deprecated I execute "dnf" command "--installroot=/dockertesting -y install TestA" with "success"

+  When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestA TestB" with "success"

+  Then _deprecated line from "stdout" should "start" with "TestA-1.0.0-1."

+  And _deprecated line from "stdout" should "start" with "TestB-1.0.0-1."

+  When _deprecated I execute "bash" command "rpm --root=/dockertesting -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "not start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+ # Install package into installroot that requires gpg-key from host (fail)

+  When _deprecated I execute "dnf" command "--installroot=/dockertesting -y install TestF" with "fail"

+  When _deprecated I execute "bash" command "rpm -q --root=/dockertesting TestF TestG TestH" with "fail"

+  Then _deprecated line from "stdout" should "not start" with "TestF"

+  And _deprecated line from "stdout" should "not start" with "TestG"

+  And _deprecated line from "stdout" should "not start" with "TestH"

tests/behave_tests/dnf-docker-test/features/gpg-checksum.feature
file added
+87
@@ -0,0 +1,87 @@

+ Feature: DNF/Behave test (gpg, check-sum)

+ 

+ Scenario: Add repository with gpgcheck=1 from repofile and control 'repolist' command

+  Given _deprecated I use the repository "test-1"

+  When _deprecated I execute "dnf" command "repolist" with "success"

+  Then _deprecated line from "stdout" should "start" with "test-1 "

+  And _deprecated line from "stdout" should "not start" with "test-1-gpg-file"

+  When _deprecated I execute "dnf" command "config-manager --add-repo http://127.0.0.1/repo/test-1-gpg/test-1-gpg-file.repo" with "success"

+  When _deprecated I execute "dnf" command "repolist test-1-g*" with "success"

+  Then _deprecated line from "stdout" should "not start" with "test-1 "

+  And _deprecated line from "stdout" should "start" with "test-1-gpg-file"

+ 

+ Scenario: GPG key import after package install

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "not start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+  When _deprecated I execute "dnf" command "-y --disablerepo=test-1 install TestA" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestA, TestB  |

+  When _deprecated I execute "bash" command "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" with "success"

+  Then _deprecated line from "stdout" should "start" with "gpg-pubkey-2d2e7ca3-56c1e69d --> gpg(DNF Test1 (TESTER) <dnf@testteam.org>)"

+ # Cleaning artifacts from test

+  When _deprecated I execute "dnf" command "-y remove TestA" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | removed      | TestA, TestB  |

+ 

+ Scenario: Install signed package with unsigned dependecy from repository with gpgcheck=1

+  When _deprecated I execute "dnf" command "-y --disablerepo=test-1 install TestD" with "fail"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | absent       | TestD, TestE  |

+ 

+ Scenario: Install signed package with signed dependece with different key from repository with gpgcheck=1

+  When _deprecated I execute "dnf" command "-y --disablerepo=test-1 install TestF" with "fail"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages             |

+    | absent       | TestF, TestG, TestH  |

+ 

+ Scenario: Install package with incorrect checksum from repository with gpgcheck=1

+  Then _deprecated the file "/var/cache/dnf/expired_repos.json" should contain "[]"

+  When _deprecated I execute "dnf" command "-y --disablerepo=test-1 install TestJ" with "fail"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | absent       | TestJ      |

+  Then _deprecated the file "/var/cache/dnf/expired_repos.json" should contain "["test-1-gpg-file"]"

+  When _deprecated I execute "dnf" command "makecache" with "success"

+  Then _deprecated the file "/var/cache/dnf/expired_repos.json" should contain "[]"

+ 

+ Scenario: Add repository with gpgcheck=0 and install package with unknown key and signed and unsigned packages

+  Given _deprecated I use the repository "test-1-gpg"

+  When _deprecated I execute "dnf" command "-y install TestF" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages             |

+    | installed    | TestF, TestG, TestH  |

+  When _deprecated I execute "dnf" command "-y install TestD" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages      |

+    | installed    | TestD, TestE  |

+ # Cleaning artifacts from test

+  When _deprecated I execute "dnf" command "-y remove TestF TestD" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages                           |

+    | removed      | TestD, TestE, TestF, TestG, TestH  |

+ 

+ Scenario: Add repository with without gpgcheck and try to install insigned package (test if gpgcheck is taken from dnf.conf)

+  Given _deprecated I use the repository "test-1"

+  When _deprecated I create a file "/etc/yum.repos.d/gpg.repo" with content: "[gpg]\nname=gpg\nbaseurl=http://127.0.0.1/repo/test-1\nenabled=1"

+  Then _deprecated the path "/etc/yum.repos.d/gpg.repo" should be "present"

+  When _deprecated I execute "dnf" command "-y --disablerepo=test-1 install TestC" with "fail"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | absent       | TestC      |

+  When _deprecated I execute "dnf" command "-y --disablerepo=test-1 --nogpgcheck install TestC" with "success"

+  Then _deprecated transaction changes are as follows

+    | State        | Packages   |

+    | installed    | TestC      |

+