You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are seeing test failures, specifically in test_network_config_schema_validation_false_when_skipped. It seems like the test code expects that removing the netplan module from sys.modules will cause an ImportError while importing netplan. Here's a stack trace and some debug output from a debugging session:
$ git log -1
commit 0f77b3c13a2f44c224c5dea18d27bbfa4898e39a (HEAD -> main, origin/main, origin/HEAD)
Author: James Falcon <[email protected]>
Date: Tue Oct 8 14:59:51 2024 -0500
chore: Use devel release and no sbuild in integration CI (#5798)
$ python3 -m pytest -v tests/unittests cloudinit -k 'test_network_config_schema_validation_false_when_skipped' --pdb
===================================================== test session starts =====================================================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/ubuntu/cloud-init-pstream
configfile: tox.ini
plugins: mock-3.12.0
collected 5142 items / 5138 deselected / 4 selected
tests/unittests/config/test_schema.py::TestNetplanValidateNetworkSchema::test_network_config_schema_validation_false_when_skipped[config0-] FAILED [ 25%]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> captured log >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2024-10-08 23:23:26 DEBUG cloudinit.util:util.py:2290 Writing to /tmp/tmpr2kaczoy/etc/netplan/network-config.yaml - wb: [600] 20 bytes
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
self = <tests.unittests.config.test_schema.TestNetplanValidateNetworkSchema object at 0x7ea520414140>, config = {}
expected_log = '', caplog = <_pytest.logging.LogCaptureFixture object at 0x7ea51f363ef0>
@pytest.mark.parametrize(
"config,expected_log",
(
({}, ""),
({"version": 1}, ""),
(
{"version": 2},
"Skipping netplan schema validation. No netplan API available",
),
(
{"network": {"version": 2}},
"Skipping netplan schema validation. No netplan API available",
),
),
)
def test_network_config_schema_validation_false_when_skipped(
self, config, expected_log, caplog
):
"""netplan_validate_network_schema returns false when skipped."""
with mock.patch.dict("sys.modules"):
sys.modules.pop("netplan", None)
> assert False is netplan_validate_network_schema(config)
E assert False is True
E + where True = netplan_validate_network_schema({})
tests/unittests/config/test_schema.py:438: AssertionError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/ubuntu/cloud-init-pstream/tests/unittests/config/test_schema.py(438)test_network_config_schema_validation_false_when_skipped()
-> assert False is netplan_validate_network_schema(config)
(Pdb) "netplan" in sys.modules
False
(Pdb) from netplan import NetplanParserException
(Pdb) "netplan" in sys.modules
True
(Pdb) sys.modules.pop("netplan", None)
<module 'netplan' from '/usr/lib/python3/dist-packages/netplan/__init__.py'>
(Pdb) from netplan import NetplanParserException
(Pdb)
Steps to reproduce the problem
On Ubuntu 24.04, run make unittest or to run only the failing tests, run this command:
Bug report
We are seeing test failures, specifically in
test_network_config_schema_validation_false_when_skipped
. It seems like the test code expects that removing thenetplan
module fromsys.modules
will cause an ImportError while importingnetplan
. Here's a stack trace and some debug output from a debugging session:Steps to reproduce the problem
On Ubuntu 24.04, run
make unittest
or to run only the failing tests, run this command:Environment details
0f77b3c13a2f44c224c5dea18d27bbfa4898e39a
of branchmain
cloud-init logs
Not applicable since these are unit test failures.
The text was updated successfully, but these errors were encountered: