Public bug reported:
apply this diff to show the error, just make 'ntp_installable' not
find a package installer. At minimum, we just need to mock that out.
$ git diff
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index 15ae1ecd..5ebdd461 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -147,6 +147,7 @@ def ntp_installable():
if util.system_is_snappy():
return False
+ return False
if any(map(util.which, ['apt-get', 'dnf', 'yum', 'zypper'])):
return True
$ tox-venv py3 python3 -m nose
tests/unittests/test_handler/test_handler_ntp.py:TestNtp
...EEEEEE............
======================================================================
ERROR: Test ntp handler renders the shipped distro ntp.conf templates.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 272, in test_ntp_handler_real_distro_templates
cc_ntp.handle('notimportant', cfg, mycloud, None, None)
File
"/home/smoser-public/src/cloud-init/cloud-init/cloudinit/config/cc_ntp.py",
line 128, in handle
write_ntp_config_template(ntp_cfg, cloud, confpath, template=template_name)
File
"/home/smoser-public/src/cloud-init/cloud-init/cloudinit/config/cc_ntp.py",
line 204, in write_ntp_config_template
"not rendering %s"), path)
RuntimeError: ('No template found, not rendering %s',
'/etc/systemd/timesyncd.conf.d/cloud-init.conf')
======================================================================
ERROR: Ntp schema validation allows for an empty ntp: configuration.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 305, in test_ntp_handler_schema_validation_allows_empty_ntp_config
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.nmgu_ja4/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of invalid keys present in ntp config.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 374, in test_ntp_handler_schema_validation_warns_invalid_key_present
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.zj7sj7n8/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of non-strings in pools or servers.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 331, in test_ntp_handler_schema_validation_warns_non_string_item_type
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.agut528j/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of duplicates in servers or pools.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 400, in test_ntp_handler_schema_validation_warns_of_duplicates
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.ykjfhbx7/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of non-array pools or servers types.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 352, in test_ntp_handler_schema_validation_warns_of_non_array_type
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.4f3ycmp1/ntp.conf'
----------------------------------------------------------------------
Ran 21 tests in 0.085s
FAILED (errors=6)
** Affects: cloud-init
Importance: Low
Status: Confirmed
** Changed in: cloud-init
Status: New => Confirmed
** Changed in: cloud-init
Importance: Undecided => Low
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1721573
Title:
ntp unit tests broken if no package program available in test
environment
Status in cloud-init:
Confirmed
Bug description:
apply this diff to show the error, just make 'ntp_installable' not
find a package installer. At minimum, we just need to mock that out.
$ git diff
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index 15ae1ecd..5ebdd461 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -147,6 +147,7 @@ def ntp_installable():
if util.system_is_snappy():
return False
+ return False
if any(map(util.which, ['apt-get', 'dnf', 'yum', 'zypper'])):
return True
$ tox-venv py3 python3 -m nose
tests/unittests/test_handler/test_handler_ntp.py:TestNtp
...EEEEEE............
======================================================================
ERROR: Test ntp handler renders the shipped distro ntp.conf templates.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 272, in test_ntp_handler_real_distro_templates
cc_ntp.handle('notimportant', cfg, mycloud, None, None)
File
"/home/smoser-public/src/cloud-init/cloud-init/cloudinit/config/cc_ntp.py",
line 128, in handle
write_ntp_config_template(ntp_cfg, cloud, confpath,
template=template_name)
File
"/home/smoser-public/src/cloud-init/cloud-init/cloudinit/config/cc_ntp.py",
line 204, in write_ntp_config_template
"not rendering %s"), path)
RuntimeError: ('No template found, not rendering %s',
'/etc/systemd/timesyncd.conf.d/cloud-init.conf')
======================================================================
ERROR: Ntp schema validation allows for an empty ntp: configuration.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 305, in test_ntp_handler_schema_validation_allows_empty_ntp_config
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.nmgu_ja4/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of invalid keys present in ntp config.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 374, in test_ntp_handler_schema_validation_warns_invalid_key_present
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.zj7sj7n8/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of non-strings in pools or servers.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 331, in test_ntp_handler_schema_validation_warns_non_string_item_type
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.agut528j/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of duplicates in servers or pools.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 400, in test_ntp_handler_schema_validation_warns_of_duplicates
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.ykjfhbx7/ntp.conf'
======================================================================
ERROR: Ntp schema validation warns of non-array pools or servers types.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_handler/test_handler_ntp.py",
line 352, in test_ntp_handler_schema_validation_warns_of_non_array_type
with open(ntp_conf) as stream:
FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/ci-TestNtp.4f3ycmp1/ntp.conf'
----------------------------------------------------------------------
Ran 21 tests in 0.085s
FAILED (errors=6)
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1721573/+subscriptions
--
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help : https://help.launchpad.net/ListHelp