Prv8 Shell
Server : Apache
System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : matalashes ( 1004)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /usr/src/cloud-init/tests/unittests/net/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/src/cloud-init/tests/unittests/net/test_dns.py
# This file is part of cloud-init. See LICENSE file for license information.

from unittest import mock

from cloudinit import safeyaml
from cloudinit.net import network_state


class TestNetDns:
    @mock.patch("cloudinit.net.network_state.get_interfaces_by_mac")
    @mock.patch("cloudinit.net.get_interfaces_by_mac")
    def test_system_mac_address_does_not_break_dns_parsing(
        self, by_mac_state, by_mac_init
    ):
        by_mac_state.return_value = {"00:11:22:33:44:55": "foobar"}
        by_mac_init.return_value = {"00:11:22:33:44:55": "foobar"}
        state = network_state.parse_net_config_data(
            safeyaml.load(
                """\
version: 2
ethernets:
  eth:
    match:
      macaddress: '00:11:22:33:44:55'
    addresses: [10.0.0.2/24]
    gateway4: 10.0.0.1
    nameservers:
      addresses: [10.0.0.3]
"""
            )
        )
        assert "10.0.0.3" in state.dns_nameservers

haha - 2025