Skip to content

Commit 70a3b2e

Browse files
jan-kolarikpkratoch
authored andcommitted
expired-pgp-keys: Add basic CI tests
1 parent b0149dd commit 70a3b2e

File tree

5 files changed

+72
-2
lines changed

5 files changed

+72
-2
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Feature: expired-pgp-keys plugin functionality
2+
3+
4+
Background:
5+
Given I enable plugin "expired-pgp-keys"
6+
And I configure dnf with
7+
| key | value |
8+
| pluginconfpath | {context.dnf.installroot}/etc/dnf/libdnf5-plugins |
9+
And I create file "/etc/dnf/libdnf5-plugins/expired-pgp-keys.conf" with
10+
"""
11+
[main]
12+
enabled = 1
13+
"""
14+
And I use repository "dnf-ci-gpg-expiry" with configuration
15+
| key | value |
16+
| gpgcheck | 1 |
17+
| gpgkey | file://{context.dnf.fixturesdir}/gpgkeys/keys/dnf-ci-gpg-expiry/dnf-ci-gpg-expiry-public |
18+
And I use repository "simple-base"
19+
And I successfully execute dnf with args "install wget"
20+
21+
22+
Scenario: When PGP key is expired, its removal is triggered before transaction
23+
Given I move the clock forward to "2 years"
24+
And I successfully execute dnf with args "install vagare"
25+
Then stderr contains lines matching
26+
"""
27+
The following PGP key \(0x.*\) is about to be removed:
28+
Reason : Expired on .*
29+
UserID : "dnf-ci-gpg-expiry"
30+
"""
31+
32+
33+
Scenario: When PGP key is expired, its removal is not triggered on non-transactional operations
34+
Given I move the clock forward to "2 years"
35+
And I successfully execute dnf with args "repoquery vagare"
36+
Then stderr does not contain "The following PGP key \(0x.*\) is about to be removed:"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
USE_EXPIRATION_DATE=1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dnf-ci-gpg-expiry/x86_64/wget-1.19.5-5.fc29.x86_64.rpm

dnf-behave-tests/fixtures/gpgkeys/sign.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ for KEY_NAME in $KEYSPECS; do
1616
# set defaults
1717
USE_SIGN_SUBKEY=0
1818
USE_NOEOF_KEYS=0
19+
USE_EXPIRATION_DATE=0
1920

2021
# read config file for key
2122
if [ -f "${DIR}/keyspecs/${KEY_NAME}/config" ]; then
@@ -37,8 +38,15 @@ for KEY_NAME in $KEYSPECS; do
3738
TMP_KEY_DIR="${TMP_DIR}/gpghome"
3839
ln -s "${KEY_DIR}" "${TMP_KEY_DIR}"
3940

40-
# create key (without password, without expire)
41-
HOME=${TMP_KEY_DIR} gpg2 --batch --passphrase '' --quick-gen-key "${KEY_NAME}" default default 0
41+
# keys are without expiration date by default
42+
# if expiration is requested, set it to 1 year from now
43+
EXPIRY_DATE=0
44+
if [ "${USE_EXPIRATION_DATE}" = "1" ]; then
45+
EXPIRY_DATE=$(date -d "+1 year" +%Y-%m-%d)
46+
fi
47+
48+
# create key (without password)
49+
HOME=${TMP_KEY_DIR} gpg2 --batch --passphrase '' --quick-gen-key "${KEY_NAME}" default default "${EXPIRY_DATE}"
4250

4351
if [ "${USE_SIGN_SUBKEY}" = "1" ]; then
4452
# add sign subkey
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Name: wget
2+
Version: 1.19.5
3+
Release: 5%{?dist}
4+
Summary: A utility for retrieving files using the HTTP or FTP protocols
5+
6+
License: GPLv3+
7+
Group: Applications/Internet
8+
Url: http://www.gnu.org/software/wget/
9+
10+
Provides: webclient
11+
Provides: bundled(gnulib)
12+
13+
%description
14+
GNU Wget is a file retrieval utility which can use either the HTTP or
15+
FTP protocols. Wget features include the ability to work in the
16+
background while you are logged out, recursive retrieval of
17+
directories, file name wildcard matching, remote file timestamp
18+
storage and comparison, use of Rest with FTP servers and Range with
19+
HTTP servers to retrieve files over slow or unstable connections,
20+
support for Proxy servers, and configurability.
21+
22+
%files
23+
24+
%changelog

0 commit comments

Comments
 (0)