|
| 1 | +From 39fed1f3b309e4aa088fedbb9174a4ec7327dfa3 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Sam Meluch <sammeluch@microsoft.com> |
| 3 | +Date: Wed, 11 Sep 2024 16:24:05 -0700 |
| 4 | +Subject: [PATCH] fix tests for azl |
| 5 | + |
| 6 | +--- |
| 7 | + pytests/repo/setup-repo.sh | 10 +++++----- |
| 8 | + pytests/tests/test_cache.py | 3 ++- |
| 9 | + pytests/tests/test_priority.py | 2 +- |
| 10 | + pytests/tests/test_signature.py | 5 +++++ |
| 11 | + pytests/tests/test_srpms.py | 2 +- |
| 12 | + 5 files changed, 14 insertions(+), 8 deletions(-) |
| 13 | + |
| 14 | +diff --git a/pytests/repo/setup-repo.sh b/pytests/repo/setup-repo.sh |
| 15 | +index a19bd20..9897715 100755 |
| 16 | +--- a/pytests/repo/setup-repo.sh |
| 17 | ++++ b/pytests/repo/setup-repo.sh |
| 18 | +@@ -65,8 +65,8 @@ mkdir -p -m 755 ${BUILD_PATH}/BUILD \ |
| 19 | + cat << EOF > ${TEST_REPO_DIR}/gpgkeydata |
| 20 | + %echo Generating a key for repogpgcheck signatures |
| 21 | + %no-protection |
| 22 | +- Key-Type: default |
| 23 | +- Subkey-Type: default |
| 24 | ++ Key-Type: RSA |
| 25 | ++ Subkey-Type: RSA |
| 26 | + Name-Real: tdnf test |
| 27 | + Name-Comment: tdnf test key |
| 28 | + Name-Email: tdnftest@tdnf.test |
| 29 | +@@ -107,9 +107,9 @@ cp -r ${BUILD_PATH}/RPMS ${PUBLISH_SHA512_PATH} |
| 30 | + mkdir -p ${PUBLISH_PATH}/keys |
| 31 | + gpg --armor --export tdnftest@tdnf.test > ${PUBLISH_PATH}/keys/pubkey.asc |
| 32 | + |
| 33 | +-createrepo ${PUBLISH_PATH} |
| 34 | +-createrepo ${PUBLISH_SRC_PATH} |
| 35 | +-createrepo -s sha512 ${PUBLISH_SHA512_PATH} |
| 36 | ++createrepo --compatibility ${PUBLISH_PATH} |
| 37 | ++createrepo --compatibility ${PUBLISH_SRC_PATH} |
| 38 | ++createrepo --compatibility -s sha512 ${PUBLISH_SHA512_PATH} |
| 39 | + |
| 40 | + modifyrepo ${REPO_SRC_DIR}/updateinfo-1.xml ${PUBLISH_PATH}/repodata |
| 41 | + check_err "Failed to modify repo with updateinfo-1.xml." |
| 42 | +diff --git a/pytests/tests/test_cache.py b/pytests/tests/test_cache.py |
| 43 | +index 2621b59..c01df02 100644 |
| 44 | +--- a/pytests/tests/test_cache.py |
| 45 | ++++ b/pytests/tests/test_cache.py |
| 46 | +@@ -189,6 +189,7 @@ def test_download_vs_cache_size_multiple_packages(utils): |
| 47 | + @pytest.mark.skipif(try_mount_small_cache() != 0, reason="Failed to mount small cache directory.") |
| 48 | + def test_cache_directory_out_of_disk_space(utils): |
| 49 | + small_cache_path = utils.config['small_cache_path'] |
| 50 | ++ orig_cache_path = utils.tdnf_config.get('main', 'cachedir') |
| 51 | + switch_cache_path(utils, small_cache_path) |
| 52 | + enable_cache(utils) |
| 53 | + clean_small_cache(utils) |
| 54 | +@@ -200,7 +201,7 @@ def test_cache_directory_out_of_disk_space(utils): |
| 55 | + run_args.append(pkgname) |
| 56 | + ret = utils.run(run_args) |
| 57 | + |
| 58 | +- switch_cache_path(utils, utils.tdnf_config.get('main', 'cachedir')) |
| 59 | ++ switch_cache_path(utils, orig_cache_path) |
| 60 | + clean_cache(utils) |
| 61 | + clean_small_cache(utils) |
| 62 | + assert ret['retval'] == 1036 |
| 63 | +diff --git a/pytests/tests/test_priority.py b/pytests/tests/test_priority.py |
| 64 | +index a3e7913..0412f45 100644 |
| 65 | +--- a/pytests/tests/test_priority.py |
| 66 | ++++ b/pytests/tests/test_priority.py |
| 67 | +@@ -42,7 +42,7 @@ def test_priority(utils): |
| 68 | + ) |
| 69 | + assert ret['retval'] == 0 |
| 70 | + |
| 71 | +- ret = utils.run(["createrepo", "."], cwd=REPODIR) |
| 72 | ++ ret = utils.run(["createrepo", "--compatibility", "."], cwd=REPODIR) |
| 73 | + assert ret['retval'] == 0 |
| 74 | + |
| 75 | + filename = os.path.join(utils.config['repo_path'], "yum.repos.d", REPOFILENAME) |
| 76 | +diff --git a/pytests/tests/test_signature.py b/pytests/tests/test_signature.py |
| 77 | +index f2f6f06..3aea87b 100644 |
| 78 | +--- a/pytests/tests/test_signature.py |
| 79 | ++++ b/pytests/tests/test_signature.py |
| 80 | +@@ -66,6 +66,7 @@ def test_install_local_key(utils): |
| 81 | + set_gpgcheck(utils, True) |
| 82 | + keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc') |
| 83 | + set_repo_key(utils, 'file://{}'.format(keypath)) |
| 84 | ++ utils.run(['rpm', '--import', keypath]) |
| 85 | + pkgname = utils.config["sglversion_pkgname"] |
| 86 | + ret = utils.run(['tdnf', 'install', '-y', pkgname]) |
| 87 | + assert ret['retval'] == 0 |
| 88 | +@@ -76,6 +77,8 @@ def test_install_local_key(utils): |
| 89 | + def test_install_remote_key(utils): |
| 90 | + set_gpgcheck(utils, True) |
| 91 | + set_repo_key(utils, 'http://localhost:8080/photon-test/keys/pubkey.asc') |
| 92 | ++ keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc') |
| 93 | ++ utils.run(['rpm', '--import', keypath]) |
| 94 | + pkgname = utils.config["sglversion_pkgname"] |
| 95 | + ret = utils.run(['tdnf', 'install', '-y', pkgname]) |
| 96 | + assert ret['retval'] == 0 |
| 97 | +@@ -86,6 +89,8 @@ def test_install_remote_key(utils): |
| 98 | + def test_install_remote_key_verbose(utils): |
| 99 | + set_gpgcheck(utils, True) |
| 100 | + set_repo_key(utils, 'http://localhost:8080/photon-test/keys/pubkey.asc') |
| 101 | ++ keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc') |
| 102 | ++ utils.run(['rpm', '--import', keypath]) |
| 103 | + pkgname = utils.config["sglversion_pkgname"] |
| 104 | + ret = utils.run(['tdnf', 'install', '-v', '-y', pkgname]) |
| 105 | + assert ret['retval'] == 0 |
| 106 | +diff --git a/pytests/tests/test_srpms.py b/pytests/tests/test_srpms.py |
| 107 | +index 8279721..ee7bed0 100644 |
| 108 | +--- a/pytests/tests/test_srpms.py |
| 109 | ++++ b/pytests/tests/test_srpms.py |
| 110 | +@@ -19,7 +19,7 @@ DIST = os.environ.get('DIST') |
| 111 | + if DIST == 'fedora': |
| 112 | + RPMBUILD_DIR = '/root/rpmbuild' |
| 113 | + else: |
| 114 | +- RPMBUILD_DIR = '/usr/src/photon' |
| 115 | ++ RPMBUILD_DIR = '/usr/src/azl' |
| 116 | + |
| 117 | + |
| 118 | + @pytest.fixture(scope='function', autouse=True) |
| 119 | +-- |
| 120 | +2.34.1 |
| 121 | + |
0 commit comments