CBL-Mariner/SPECS/tdnf/fix-tests-for-azl.patch

122 строки
4.9 KiB
Diff

From 39fed1f3b309e4aa088fedbb9174a4ec7327dfa3 Mon Sep 17 00:00:00 2001
From: Sam Meluch <sammeluch@microsoft.com>
Date: Wed, 11 Sep 2024 16:24:05 -0700
Subject: [PATCH] fix tests for azl
---
pytests/repo/setup-repo.sh | 10 +++++-----
pytests/tests/test_cache.py | 3 ++-
pytests/tests/test_priority.py | 2 +-
pytests/tests/test_signature.py | 5 +++++
pytests/tests/test_srpms.py | 2 +-
5 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/pytests/repo/setup-repo.sh b/pytests/repo/setup-repo.sh
index a19bd20..9897715 100755
--- a/pytests/repo/setup-repo.sh
+++ b/pytests/repo/setup-repo.sh
@@ -65,8 +65,8 @@ mkdir -p -m 755 ${BUILD_PATH}/BUILD \
cat << EOF > ${TEST_REPO_DIR}/gpgkeydata
%echo Generating a key for repogpgcheck signatures
%no-protection
- Key-Type: default
- Subkey-Type: default
+ Key-Type: RSA
+ Subkey-Type: RSA
Name-Real: tdnf test
Name-Comment: tdnf test key
Name-Email: tdnftest@tdnf.test
@@ -107,9 +107,9 @@ cp -r ${BUILD_PATH}/RPMS ${PUBLISH_SHA512_PATH}
mkdir -p ${PUBLISH_PATH}/keys
gpg --armor --export tdnftest@tdnf.test > ${PUBLISH_PATH}/keys/pubkey.asc
-createrepo ${PUBLISH_PATH}
-createrepo ${PUBLISH_SRC_PATH}
-createrepo -s sha512 ${PUBLISH_SHA512_PATH}
+createrepo --compatibility ${PUBLISH_PATH}
+createrepo --compatibility ${PUBLISH_SRC_PATH}
+createrepo --compatibility -s sha512 ${PUBLISH_SHA512_PATH}
modifyrepo ${REPO_SRC_DIR}/updateinfo-1.xml ${PUBLISH_PATH}/repodata
check_err "Failed to modify repo with updateinfo-1.xml."
diff --git a/pytests/tests/test_cache.py b/pytests/tests/test_cache.py
index 2621b59..c01df02 100644
--- a/pytests/tests/test_cache.py
+++ b/pytests/tests/test_cache.py
@@ -189,6 +189,7 @@ def test_download_vs_cache_size_multiple_packages(utils):
@pytest.mark.skipif(try_mount_small_cache() != 0, reason="Failed to mount small cache directory.")
def test_cache_directory_out_of_disk_space(utils):
small_cache_path = utils.config['small_cache_path']
+ orig_cache_path = utils.tdnf_config.get('main', 'cachedir')
switch_cache_path(utils, small_cache_path)
enable_cache(utils)
clean_small_cache(utils)
@@ -200,7 +201,7 @@ def test_cache_directory_out_of_disk_space(utils):
run_args.append(pkgname)
ret = utils.run(run_args)
- switch_cache_path(utils, utils.tdnf_config.get('main', 'cachedir'))
+ switch_cache_path(utils, orig_cache_path)
clean_cache(utils)
clean_small_cache(utils)
assert ret['retval'] == 1036
diff --git a/pytests/tests/test_priority.py b/pytests/tests/test_priority.py
index a3e7913..0412f45 100644
--- a/pytests/tests/test_priority.py
+++ b/pytests/tests/test_priority.py
@@ -42,7 +42,7 @@ def test_priority(utils):
)
assert ret['retval'] == 0
- ret = utils.run(["createrepo", "."], cwd=REPODIR)
+ ret = utils.run(["createrepo", "--compatibility", "."], cwd=REPODIR)
assert ret['retval'] == 0
filename = os.path.join(utils.config['repo_path'], "yum.repos.d", REPOFILENAME)
diff --git a/pytests/tests/test_signature.py b/pytests/tests/test_signature.py
index f2f6f06..3aea87b 100644
--- a/pytests/tests/test_signature.py
+++ b/pytests/tests/test_signature.py
@@ -66,6 +66,7 @@ def test_install_local_key(utils):
set_gpgcheck(utils, True)
keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc')
set_repo_key(utils, 'file://{}'.format(keypath))
+ utils.run(['rpm', '--import', keypath])
pkgname = utils.config["sglversion_pkgname"]
ret = utils.run(['tdnf', 'install', '-y', pkgname])
assert ret['retval'] == 0
@@ -76,6 +77,8 @@ def test_install_local_key(utils):
def test_install_remote_key(utils):
set_gpgcheck(utils, True)
set_repo_key(utils, 'http://localhost:8080/photon-test/keys/pubkey.asc')
+ keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc')
+ utils.run(['rpm', '--import', keypath])
pkgname = utils.config["sglversion_pkgname"]
ret = utils.run(['tdnf', 'install', '-y', pkgname])
assert ret['retval'] == 0
@@ -86,6 +89,8 @@ def test_install_remote_key(utils):
def test_install_remote_key_verbose(utils):
set_gpgcheck(utils, True)
set_repo_key(utils, 'http://localhost:8080/photon-test/keys/pubkey.asc')
+ keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc')
+ utils.run(['rpm', '--import', keypath])
pkgname = utils.config["sglversion_pkgname"]
ret = utils.run(['tdnf', 'install', '-v', '-y', pkgname])
assert ret['retval'] == 0
diff --git a/pytests/tests/test_srpms.py b/pytests/tests/test_srpms.py
index 8279721..ee7bed0 100644
--- a/pytests/tests/test_srpms.py
+++ b/pytests/tests/test_srpms.py
@@ -19,7 +19,7 @@ DIST = os.environ.get('DIST')
if DIST == 'fedora':
RPMBUILD_DIR = '/root/rpmbuild'
else:
- RPMBUILD_DIR = '/usr/src/photon'
+ RPMBUILD_DIR = '/usr/src/azl'
@pytest.fixture(scope='function', autouse=True)
--
2.34.1