Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail on master #125

Closed
rominf opened this issue Jun 21, 2023 · 0 comments
Closed

Tests fail on master #125

rominf opened this issue Jun 21, 2023 · 0 comments

Comments

@rominf
Copy link

rominf commented Jun 21, 2023

I get the following output while running tox:

===================================================================== test session starts =====================================================================
platform linux -- Python 3.8.12, pytest-7.3.2, pluggy-1.2.0
cachedir: .tox/py38/.pytest_cache
rootdir: /home/rominf/dev/cs
configfile: setup.cfg
plugins: cov-4.1.0
collected 15 items

tests.py .FFF...........                                                                                                                                [100%]

========================================================================== FAILURES ===========================================================================
_____________________________________________________________ ConfigTest.test_current_dir_config ______________________________________________________________

self = <tests.ConfigTest testMethod=test_current_dir_config>

    def test_current_dir_config(self):
        with open('/tmp/cloudstack.ini', 'w') as f:
            f.write('[cloudstack]\n'
                    'endpoint = https://api.example.com/from-file\n'
                    'key = test key from file\n'
                    'secret = test secret from file\n'
                    'dangerous_no_tls_verify = true\n'
                    'theme = monokai\n'
                    'other = please ignore me\n'
                    'header_x-custom-header1 = foo\n'
                    'header_x-custom-header2 = bar\n'
                    'timeout = 50')
            self.addCleanup(partial(os.remove, '/tmp/cloudstack.ini'))

        with cwd('/tmp'):
            conf = read_config()
>           self.assertEqual({
                'endpoint': 'https://api.example.com/from-file',
                'key': 'test key from file',
                'secret': 'test secret from file',
                'expiration': 600,
                'theme': 'monokai',
                'timeout': '50',
                'trace': None,
                'poll_interval': 2.0,
                'name': 'cloudstack',
                'poll_interval': 2.0,
                'verify': None,
                'dangerous_no_tls_verify': True,
                'retry': 0,
                'method': 'get',
                'cert': None,
                'headers': {
                    'x-custom-header1': 'foo',
                    'x-custom-header2': 'bar',
                },
            }, conf)
E           AssertionError: {'endpoint': 'https://api.example.com/from-[339 chars]ar'}} != {'timeout': '50', 'method': 'get', 'retry':[354 chars]ar'}}
E             {'cert': None,
E           +  'cert_key': None,
E           -  'dangerous_no_tls_verify': True,
E           ?                             ^^^^
E
E           +  'dangerous_no_tls_verify': 1,
E           ?                             ^
E
E              'endpoint': 'https://api.example.com/from-file',
E              'expiration': 600,
E              'headers': {'x-custom-header1': 'foo', 'x-custom-header2': 'bar'},
E              'key': 'test key from file',
E              'method': 'get',
E              'name': 'cloudstack',
E              'poll_interval': 2.0,
E              'retry': 0,
E              'secret': 'test secret from file',
E              'theme': 'monokai',
E              'timeout': '50',
E              'trace': None,
E              'verify': None}

tests.py:165: AssertionError
______________________________________________________ ConfigTest.test_env_var_combined_with_dir_config _______________________________________________________

self = <tests.ConfigTest testMethod=test_env_var_combined_with_dir_config>

    def test_env_var_combined_with_dir_config(self):
        with open('/tmp/cloudstack.ini', 'w') as f:
            f.write('[hanibal]\n'
                    'endpoint = https://api.example.com/from-file\n'
                    'key = test key from file\n'
                    'secret = secret from file\n'
                    'theme = monokai\n'
                    'other = please ignore me\n'
                    'timeout = 50')
            self.addCleanup(partial(os.remove, '/tmp/cloudstack.ini'))
        # Secret gets read from env var
        with env(CLOUDSTACK_ENDPOINT='https://api.example.com/from-env',
                 CLOUDSTACK_KEY='test key from env',
                 CLOUDSTACK_SECRET='test secret from env',
                 CLOUDSTACK_REGION='hanibal',
                 CLOUDSTACK_DANGEROUS_NO_TLS_VERIFY='1',
                 CLOUDSTACK_OVERRIDES='endpoint,secret'), cwd('/tmp'):
            conf = read_config()
>           self.assertEqual({
                'endpoint': 'https://api.example.com/from-env',
                'key': 'test key from file',
                'secret': 'test secret from env',
                'expiration': 600,
                'theme': 'monokai',
                'timeout': '50',
                'trace': None,
                'poll_interval': 2.0,
                'name': 'hanibal',
                'poll_interval': 2.0,
                'verify': None,
                'dangerous_no_tls_verify': True,
                'retry': 0,
                'method': 'get',
                'cert': None,
            }, conf)
E           AssertionError: {'endpoint': 'https://api.example.com/from-[267 chars]None} != {'timeout': '50', 'method': 'get', 'retry':[282 chars]kai'}
E             {'cert': None,
E           +  'cert_key': None,
E           -  'dangerous_no_tls_verify': True,
E           ?                             ^^^^
E
E           +  'dangerous_no_tls_verify': 1,
E           ?                             ^
E
E              'endpoint': 'https://api.example.com/from-env',
E              'expiration': 600,
E              'key': 'test key from file',
E              'method': 'get',
E              'name': 'hanibal',
E              'poll_interval': 2.0,
E              'retry': 0,
E              'secret': 'test secret from env',
E              'theme': 'monokai',
E              'timeout': '50',
E              'trace': None,
E              'verify': None}

tests.py:131: AssertionError
__________________________________________________________________ ConfigTest.test_env_vars ___________________________________________________________________

self = <tests.ConfigTest testMethod=test_env_vars>

    def test_env_vars(self):
        with env(CLOUDSTACK_KEY='test key from env',
                 CLOUDSTACK_SECRET='test secret from env',
                 CLOUDSTACK_ENDPOINT='https://api.example.com/from-env'):
            conf = read_config()
>           self.assertEqual({
                'key': 'test key from env',
                'secret': 'test secret from env',
                'endpoint': 'https://api.example.com/from-env',
                'expiration': 600,
                'method': 'get',
                'trace': None,
                'timeout': 10,
                'poll_interval': 2.0,
                'verify': None,
                'dangerous_no_tls_verify': False,
                'cert': None,
                'name': None,
                'retry': 0,
            }, conf)
E           AssertionError: {'key': 'test key from env', 'secret': 'tes[240 chars]': 0} != {'timeout': 10, 'method': 'get', 'retry': 0[258 chars]env'}
E             {'cert': None,
E           +  'cert_key': None,
E              'dangerous_no_tls_verify': False,
E              'endpoint': 'https://api.example.com/from-env',
E              'expiration': 600,
E              'key': 'test key from env',
E              'method': 'get',
E              'name': None,
E              'poll_interval': 2.0,
E              'retry': 0,
E              'secret': 'test secret from env',
E              'timeout': 10,
E              'trace': None,
E              'verify': None}

tests.py:72: AssertionError

This prevents me from packaging for Fedora.

brutasse added a commit that referenced this issue Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant