!17 [sync] PR-13: Fixed testcase failure due to python-crypto removal

From: @openeuler-sync-bot 
Reviewed-by: @wk333 
Signed-off-by: @wk333
This commit is contained in:
openeuler-ci-bot 2024-05-28 09:34:15 +00:00 committed by Gitee
commit ffb3cb5d27
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 65 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Name: ansible-2.9 Name: ansible-2.9
Summary: SSH-based configuration management, deployment, and task execution system Summary: SSH-based configuration management, deployment, and task execution system
Version: 2.9.24 Version: 2.9.24
Release: 4 Release: 5
License: GPLv3+ License: GPLv3+
Source0: https://releases.ansible.com/ansible/ansible-%{version}.tar.gz Source0: https://releases.ansible.com/ansible/ansible-%{version}.tar.gz
Source1: ansible.attr 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 Patch5: Skip-some-test-cases-that-fail-because-the-pytest-too-old.patch
Patch6: ansible-2.9.23-sphinx4.patch Patch6: ansible-2.9.23-sphinx4.patch
Patch7: ansible-2.9.27-pyyaml-6-compat.patch Patch7: ansible-2.9.27-pyyaml-6-compat.patch
Patch8: skip-crypto-testscase.patch
Provides: ansible-2.9-python3 = %{version}-%{release} Provides: ansible-2.9-python3 = %{version}-%{release}
Obsoletes: ansible-2.9-python3 < %{version}-%{release} Obsoletes: ansible-2.9-python3 < %{version}-%{release}
Conflicts: ansible-base > 2.10.0 Conflicts: ansible-base > 2.10.0
@ -174,6 +175,9 @@ make PYTHON=/usr/bin/python3 tests-py3
%{python3_sitelib}/ansible_test %{python3_sitelib}/ansible_test
%changelog %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 <thistleslyn@163.com> - 2.9.24-4 * Mon May 29 2023 liyanan <thistleslyn@163.com> - 2.9.24-4
- modify buildrequire crypto to cryptography - modify buildrequire crypto to cryptography

View File

@ -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