test, integ: clean auto_dns and auto_routes before tests
In order to run the tests out of the containers when cleaning the state nmstate needs to make sure that all the interfaces are using static DNS and routes. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
This commit is contained in:
parent
7d13ec245d
commit
37bc3c7ae6
@ -25,6 +25,8 @@ import pytest
|
||||
|
||||
import libnmstate
|
||||
from libnmstate.schema import DNS
|
||||
from libnmstate.schema import Interface
|
||||
from libnmstate.schema import InterfaceIP
|
||||
from libnmstate.schema import Route
|
||||
from libnmstate.schema import RouteRule
|
||||
|
||||
@ -84,6 +86,15 @@ def _empty_net_state():
|
||||
Route.CONFIG: [{Route.STATE: Route.STATE_ABSENT}]
|
||||
}
|
||||
desired_state[RouteRule.KEY] = {RouteRule.CONFIG: []}
|
||||
|
||||
for iface_state in desired_state[Interface.KEY]:
|
||||
if iface_state[Interface.IPV4][InterfaceIP.ENABLED]:
|
||||
iface_state[Interface.IPV4][InterfaceIP.AUTO_DNS] = False
|
||||
iface_state[Interface.IPV4][InterfaceIP.AUTO_ROUTES] = False
|
||||
if iface_state[Interface.IPV6][InterfaceIP.ENABLED]:
|
||||
iface_state[Interface.IPV6][InterfaceIP.AUTO_DNS] = False
|
||||
iface_state[Interface.IPV6][InterfaceIP.AUTO_ROUTES] = False
|
||||
|
||||
libnmstate.apply(desired_state)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user