Code review comment for lp:~hloeung/ubuntu-repository-cache/health-check-retries-on-failure

Revision history for this message
Benjamin Allot (ballot) wrote :

I see various number of test failure when running the `make test`

https://pastebin.canonical.com/p/BWrn6vYB46/

I had 1 first, then 4 failures and kept getting 4 failures.

I looked into the first one:
```
tests/unit/test_apache.py::TestCharm::test_configure_health_check FAILED
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

self = <test_apache.TestCharm testMethod=test_configure_health_check>, check_call = <MagicMock name='check_call' id='139841716545280'>, call = <MagicMock name='call' id='139841716291136'>
seteuid = <MagicMock name='seteuid' id='139841716303232'>, setegid = <MagicMock name='setegid' id='139841716311232'>, chown = <MagicMock name='chown' id='139841715627488'>
write_file = <MagicMock name='write_file' id='139841715237360'>

    @mock.patch('charmhelpers.core.host.write_file')
    @mock.patch('os.chown')
    @mock.patch('os.setegid')
    @mock.patch('os.seteuid')
    @mock.patch('subprocess.call')
    @mock.patch('subprocess.check_call')
    def test_configure_health_check(self, check_call, call, seteuid, setegid, chown, write_file):
        config = hookenv.Config({'enable_healthcheck': True})
> self.assertTrue(apache.configure_health_check(config))
E AssertionError: False is not true

tests/unit/test_apache.py:63: AssertionError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /usr/lib/python3.8/unittest/case.py(765)assertTrue()
-> raise self.failureException(msg)
(Pdb) u
> /home/ballot/repos/charms/ubuntu-repository-cache/health-check-retries-on-failure/tests/unit/test_apache.py(63)test_configure_health_check()
-> self.assertTrue(apache.configure_health_check(config))
(Pdb) pp config
{'apache2_server_signature': 'On',
 'apache2_server_tokens': 'OS',
 'apache2_trace_enabled': 'Off',
 'display-host': 'archive.ubuntu.com',
 'enable_healthcheck': True,
 'path-base': 'ubuntu',
 'remoteip_logging': True,
 'sync-host': 'us.archive.ubuntu.com'}
```

Apparently the `if config.changed('enable_healthcheck'):` is not triggered by `config = hookenv.Config({'enable_healthcheck': True})`

« Back to merge proposal