From 77628d06ca6b570e6e46e9ac8fab60f8a436eff8 Mon Sep 17 00:00:00 2001 From: cherry530 <707078654@qq.com> Date: Wed, 15 Nov 2023 12:22:34 +0800 Subject: [PATCH] Fixed testcase failure due to python-crypto removal Signed-off-by: cherry530 <707078654@qq.com> (cherry picked from commit a818ca24926ad38ed23c9287906064fe70940056) --- ansible-2.9.spec | 6 +++- skip-crypto-testscase.patch | 60 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 skip-crypto-testscase.patch diff --git a/ansible-2.9.spec b/ansible-2.9.spec index 3cc82c6..ffda896 100644 --- a/ansible-2.9.spec +++ b/ansible-2.9.spec @@ -2,7 +2,7 @@ Name: ansible-2.9 Summary: SSH-based configuration management, deployment, and task execution system Version: 2.9.24 -Release: 4 +Release: 5 License: GPLv3+ Source0: https://releases.ansible.com/ansible/ansible-%{version}.tar.gz Source1: ansible.attr @@ -17,6 +17,7 @@ Patch4: Disable-strict-markers-with-pytest-3.6.patch Patch5: Skip-some-test-cases-that-fail-because-the-pytest-too-old.patch Patch6: ansible-2.9.23-sphinx4.patch Patch7: ansible-2.9.27-pyyaml-6-compat.patch +Patch8: skip-crypto-testscase.patch Provides: ansible-2.9-python3 = %{version}-%{release} Obsoletes: ansible-2.9-python3 < %{version}-%{release} Conflicts: ansible-base > 2.10.0 @@ -174,6 +175,9 @@ make PYTHON=/usr/bin/python3 tests-py3 %{python3_sitelib}/ansible_test %changelog +* Wed Nov 15 2023 xu_ping <707078654@qq.com> - 2.9.24-5 +- fix crypto testcase failed due to python-crypto removal. + * Mon May 29 2023 liyanan - 2.9.24-4 - modify buildrequire crypto to cryptography diff --git a/skip-crypto-testscase.patch b/skip-crypto-testscase.patch new file mode 100644 index 0000000..1291f9e --- /dev/null +++ b/skip-crypto-testscase.patch @@ -0,0 +1,60 @@ +From b01f683aca986cc58b515aa02c7b3e67977b7bba Mon Sep 17 00:00:00 2001 +From: xu_ping <707078654@qq.com> +Date: Wed, 15 Nov 2023 11:10:55 +0800 +Subject: [PATCH] skip crypto testscase + +Signed-off-by: xu_ping <707078654@qq.com> +--- + test/units/parsing/vault/test_vault.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/test/units/parsing/vault/test_vault.py b/test/units/parsing/vault/test_vault.py +index c7d6b8d8..13d434e1 100644 +--- a/test/units/parsing/vault/test_vault.py ++++ b/test/units/parsing/vault/test_vault.py +@@ -40,6 +40,7 @@ from ansible.parsing import vault + from units.mock.loader import DictDataLoader + from units.mock.vault_helper import TextVaultSecret + ++skipmark = pytest.mark.skip(reason='crypto package is recycle') + + class TestUnhexlify(unittest.TestCase): + def test(self): +@@ -510,7 +511,7 @@ class TestVaultCipherAes256(unittest.TestCase): + b_key_cryptography = self.vault_cipher._create_key_cryptography(b_password, b_salt, key_length=32, iv_length=16) + self.assertIsInstance(b_key_cryptography, six.binary_type) + +- @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason='Not testing pycrypto key as pycrypto is not installed') ++ @skipmark + def test_create_key_pycrypto(self): + b_password = b'hunter42' + b_salt = os.urandom(32) +@@ -518,8 +519,7 @@ class TestVaultCipherAes256(unittest.TestCase): + b_key_pycrypto = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) + self.assertIsInstance(b_key_pycrypto, six.binary_type) + +- @pytest.mark.skipif(not vault.HAS_PYCRYPTO, +- reason='Not comparing cryptography key to pycrypto key as pycrypto is not installed') ++ @skipmark + def test_compare_new_keys(self): + b_password = b'hunter42' + b_salt = os.urandom(32) +@@ -528,6 +528,7 @@ class TestVaultCipherAes256(unittest.TestCase): + b_key_pycrypto = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) + self.assertEqual(b_key_cryptography, b_key_pycrypto) + ++ @skipmark + def test_create_key_known_cryptography(self): + b_password = b'hunter42' + +@@ -555,6 +556,7 @@ class TestVaultCipherAes256(unittest.TestCase): + self.assertEqual(b_key_3, b_key_4) + self.assertEqual(b_key_1, b_key_4) + ++ @skipmark + def test_create_key_known_pycrypto(self): + b_password = b'hunter42' + +-- +2.27.0 + -- Gitee