|
| 1 | +From 43e05d3beea1d6e772fe88c051abf006c2a9bf90 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Marek Czernek < [email protected]> |
| 3 | +Date: Thu, 3 Oct 2024 13:08:16 +0200 |
| 4 | +Subject: [PATCH] Fix x509 private key tests and test_suse on SLE12 |
| 5 | + (#684) |
| 6 | + |
| 7 | +--- |
| 8 | + .../functional/modules/test_x509_v2.py | 12 +++++++++-- |
| 9 | + .../functional/states/pkgrepo/test_suse.py | 20 +++++++++---------- |
| 10 | + 2 files changed, 20 insertions(+), 12 deletions(-) |
| 11 | + |
| 12 | +diff --git a/tests/pytests/functional/modules/test_x509_v2.py b/tests/pytests/functional/modules/test_x509_v2.py |
| 13 | +index 7de8f3b01f..3db78c1b63 100644 |
| 14 | +--- a/tests/pytests/functional/modules/test_x509_v2.py |
| 15 | ++++ b/tests/pytests/functional/modules/test_x509_v2.py |
| 16 | +@@ -1442,14 +1442,22 @@ def test_create_private_key_with_passphrase(x509, algo): |
| 17 | + |
| 18 | + @pytest.mark.slow_test |
| 19 | + def test_create_private_key_der(x509): |
| 20 | +- res = x509.create_private_key(algo="ec", encoding="der") |
| 21 | ++ try: |
| 22 | ++ res = x509.create_private_key(algo="ec", encoding="der") |
| 23 | ++ except NotImplementedError: |
| 24 | ++ pytest.skip("Algorithm 'ec' is not supported on this OpenSSL version") |
| 25 | + assert base64.b64decode(res) |
| 26 | + |
| 27 | + |
| 28 | + @pytest.mark.slow_test |
| 29 | + @pytest.mark.parametrize("passphrase", [None, "hunter2"]) |
| 30 | + def test_create_private_key_pkcs12(x509, passphrase): |
| 31 | +- res = x509.create_private_key(algo="ec", encoding="pkcs12", passphrase=passphrase) |
| 32 | ++ try: |
| 33 | ++ res = x509.create_private_key( |
| 34 | ++ algo="ec", encoding="pkcs12", passphrase=passphrase |
| 35 | ++ ) |
| 36 | ++ except NotImplementedError: |
| 37 | ++ pytest.skip("Algorithm 'ec' is not supported on this OpenSSL version") |
| 38 | + assert base64.b64decode(res) |
| 39 | + |
| 40 | + |
| 41 | +diff --git a/tests/pytests/functional/states/pkgrepo/test_suse.py b/tests/pytests/functional/states/pkgrepo/test_suse.py |
| 42 | +index 3bafeedc94..d21a9aeb9d 100644 |
| 43 | +--- a/tests/pytests/functional/states/pkgrepo/test_suse.py |
| 44 | ++++ b/tests/pytests/functional/states/pkgrepo/test_suse.py |
| 45 | +@@ -28,14 +28,14 @@ def suse_state_tree(grains, pkgrepo, state_tree): |
| 46 | + - comments: |
| 47 | + - '# Salt Test' |
| 48 | + - refresh: 1 |
| 49 | +- {% if grains['osmajorrelease'] == 15 %} |
| 50 | +- - baseurl: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/ |
| 51 | +- - humanname: openSUSE Backports for SLE 15 SP4 |
| 52 | +- - gpgkey: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/repodata/repomd.xml.key |
| 53 | +- {% elif grains['osfullname'] == 'openSUSE Tumbleweed' %} |
| 54 | ++ {% if grains['osfullname'] == 'openSUSE Tumbleweed' %} |
| 55 | + - baseurl: http://download.opensuse.org/tumbleweed/repo/oss/ |
| 56 | + - humanname: openSUSE Tumbleweed OSS |
| 57 | + - gpgkey: https://download.opensuse.org/tumbleweed/repo/oss/repodata/repomd.xml.key |
| 58 | ++ {% else %} |
| 59 | ++ - baseurl: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/ |
| 60 | ++ - humanname: openSUSE Backports for SLE 15 SP4 |
| 61 | ++ - gpgkey: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/repodata/repomd.xml.key |
| 62 | + {% endif %} |
| 63 | + """ |
| 64 | + |
| 65 | +@@ -53,14 +53,14 @@ def suse_state_tree(grains, pkgrepo, state_tree): |
| 66 | + - comments: |
| 67 | + - '# Salt Test (modified)' |
| 68 | + - refresh: 1 |
| 69 | +- {% if grains['osmajorrelease'] == 15 %} |
| 70 | +- - baseurl: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/ |
| 71 | +- - humanname: Salt modified Backports |
| 72 | +- - gpgkey: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/repodata/repomd.xml.key |
| 73 | +- {% elif grains['osfullname'] == 'openSUSE Tumbleweed' %} |
| 74 | ++ {% if grains['osfullname'] == 'openSUSE Tumbleweed' %} |
| 75 | + - baseurl: http://download.opensuse.org/tumbleweed/repo/oss/ |
| 76 | + - humanname: Salt modified OSS |
| 77 | + - gpgkey: https://download.opensuse.org/tumbleweed/repo/oss/repodata/repomd.xml.key |
| 78 | ++ {% else %} |
| 79 | ++ - baseurl: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/ |
| 80 | ++ - humanname: Salt modified Backports |
| 81 | ++ - gpgkey: https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/repodata/repomd.xml.key |
| 82 | + {% endif %} |
| 83 | + """ |
| 84 | + |
| 85 | +-- |
| 86 | +2.46.1 |
| 87 | + |
0 commit comments