Merge "Temporary skip part of SAN certificates tests for DebianOS" into f/centos8

This commit is contained in:
Zuul 2021-08-13 22:06:27 +00:00 committed by Gerrit Code Review
commit d3b04686bd

View File

@ -11,6 +11,7 @@ Tests for the API /certificate_install/delete methods.
import json
import mock
import os
import sys
import uuid as UUID
from cryptography import x509
from cryptography.hazmat.backends import default_backend
@ -21,6 +22,21 @@ from sysinv.tests.api import base
from sysinv.tests.db import utils as dbutils
SKIP_PYTHON_VERSIONS = {'RFC_6125': [(3, 9)]}
def check_skip_test(test_reference):
# In Python 3.9 versus Python 3.6 RFC 6125 got handling improvements
# in the STDLIB. Check _dnsname_match implementation.
versions = SKIP_PYTHON_VERSIONS['RFC_6125']
runtime_version = sys.version_info[:2]
if (runtime_version[0], runtime_version[1]) in versions:
test_reference.skipTest("Skipping SAN tests not aligning to RFC 6125, "
"section 6.4.3 in Python {}.{}"
"".format(runtime_version[0],
runtime_version[1]))
class FakeConductorAPI(object):
def __init__(self):
@ -68,6 +84,8 @@ class CertificateTestCase(base.FunctionalTest):
# This certificate contains
# CN: *.vbox.local
# DNS:*.*.vbox.local, DNS:bad.*.vbox.local
check_skip_test(self)
certfile = os.path.join(os.path.dirname(__file__), "data",
'cert-with-key-invalidDNS.pem')
with open(certfile, 'rb') as f:
@ -112,6 +130,7 @@ class CertificateTestCase(base.FunctionalTest):
# This certificate contains
# CN: *.vbox.local
# DNS: *.vbox.local, bad.*.vbox.local, *.example.com
check_skip_test(self)
certfile = os.path.join(os.path.dirname(__file__), "data",
'cert-with-key-multiSAN.pem')
@ -137,6 +156,7 @@ class CertificateTestCase(base.FunctionalTest):
# This certificate contains
# CN: *.vbox.local
# DNS: bad.*.vbox.local, *.example.com
check_skip_test(self)
certfile = os.path.join(os.path.dirname(__file__), "data",
'cert-with-key-CNdifferSAN.pem')