Broken test in test_maas_certificates

Bug #1882806 reported by Dougal Matthews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Medium
Lee Trager
2.8
Fix Released
Medium
Alberto Donato

Bug Description

This test is currently failing and will be marked as a expected failure in https://code.launchpad.net/~d0ugal/maas/+git/maas/+merge/385351

======================================================================
ERROR: provisioningserver.tests.test_maas_certificates.TestMAASCertificates.test_generate_certificate_if_needed
----------------------------------------------------------------------
testtools.testresult.real._StringException: Empty attachments:
  Twisted logs

Traceback (most recent call last):
  File "/home/ubuntu/code/maas/src/maastesting/runtest.py", line 126, in _run_user
    result = function(*args, **kwargs)
  File "/home/ubuntu/code/maas/.ve/lib/python3.6/site-packages/testtools/testcase.py", line 719, in _run_test_method
    return self._get_test_method()()
  File "/home/ubuntu/code/maas/src/provisioningserver/tests/test_maas_certificates.py", line 69, in test_generate_certificate_if_needed
    self.assertTrue(maas_certificates.generate_certificate_if_needed())
  File "/home/ubuntu/code/maas/src/provisioningserver/maas_certificates.py", line 117, in generate_certificate_if_needed
    elif _cert_mtime and _cert_mtime != os.path.getmtime(MAAS_CERTIFICATE):
  File "/usr/lib/python3.6/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpm5mo4klc/maas.crt'

Related branches

Revision history for this message
Alberto Donato (ack) wrote :

This might be related to the globals in maas_certificates.py

_cert_not_before = None
_cert_not_after = None
_cert_mtime = None

We should investigate not caching those values, unless it's really expensive not to do so.

Changed in maas:
status: Confirmed → Triaged
Lee Trager (ltrager)
Changed in maas:
assignee: Dougal Matthews (d0ugal) → Lee Trager (ltrager)
Changed in maas:
status: Triaged → Fix Committed
Alberto Donato (ack)
no longer affects: maas/2.8
Changed in maas:
milestone: 2.8.0 → 2.9.0b1
status: Fix Committed → Triaged
no longer affects: maas/2.8
Changed in maas:
milestone: 2.9.0b1 → none
no longer affects: maas/2.8
Alberto Donato (ack)
Changed in maas:
milestone: none → 2.9.0b1
status: Triaged → Fix Committed
Lee Trager (ltrager)
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.