Skip to content

WIP: Fix mock in broken netconfig test#1116

Closed
holmanb wants to merge 2 commits into
canonical:mainfrom
holmanb:holmanb/fix-broken-test
Closed

WIP: Fix mock in broken netconfig test#1116
holmanb wants to merge 2 commits into
canonical:mainfrom
holmanb:holmanb/fix-broken-test

Conversation

@holmanb
Copy link
Copy Markdown
Member

@holmanb holmanb commented Nov 19, 2021

Proposed Commit Message

Fix broken netconfig test

Additional Context

currently:

tests/unittests/test_distros/test_netconfig.py F                                                                                                                 [100%]

=============================================================================== FAILURES ===============================================================================
____________________________________________________ TestNetCfgDistroArch.test_apply_network_config_v1_with_netplan ____________________________________________________

self = <tests.unittests.test_distros.test_netconfig.TestNetCfgDistroArch testMethod=test_apply_network_config_v1_with_netplan>

>   ???

/home/holmanb/cloud-init/tests/unittests/distros/test_netconfig.py:787: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/holmanb/cloud-init/tests/unittests/distros/test_netconfig.py:720: in _apply_and_verify
    ???
cloudinit/distros/__init__.py:222: in apply_network_config
    self._write_network_state(network_state)
cloudinit/distros/arch.py:66: in _write_network_state
    super()._write_network_state(network_state)
cloudinit/distros/__init__.py:125: in _write_network_state
    renderer.render_network_state(network_state)
cloudinit/net/netplan.py:242: in render_network_state
    self._net_setup_link(run=self._postcmds)
cloudinit/net/netplan.py:260: in _net_setup_link
    for iface in get_devicelist() if
cloudinit/net/__init__.py:355: in get_devicelist
    if util.is_FreeBSD() or util.is_DragonFlyBSD():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @lru_cache()
    def is_DragonFlyBSD():
>       return system_info()['variant'] == "dragonfly"
E       KeyError: 'variant'

cloudinit/util.py:410: KeyError

is_FreeBSD was mocked, I assume is_DragonFlyBSD() was added after and this test doesn't get run regularly

Test:

pytest tests/unittests/test_distros/test_netconfig.py

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

@holmanb holmanb changed the title Fix mock in broken netconfig test WIP: Fix mock in broken netconfig test Nov 19, 2021
@blackboxsw
Copy link
Copy Markdown
Collaborator

Hrm, I think this might be "fixed" by #1117

@holmanb
Copy link
Copy Markdown
Member Author

holmanb commented Nov 22, 2021

Hrm, I think this might be "fixed" by #1117

Yep! I hadn't looked at that PR yet at that point. I can close this.

@holmanb holmanb closed this Nov 22, 2021
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

Successfully merging this pull request may close these issues.

2 participants