mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add network module integration tests
This commit is contained in:
parent
0a43dde5fc
commit
bbf9987c19
2 changed files with 59 additions and 0 deletions
58
tests/integration/modules/test_network.py
Normal file
58
tests/integration/modules/test_network.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.utils
|
||||
|
||||
URL = 'repo.saltstack.com'
|
||||
|
||||
|
||||
class NetworkTest(ModuleCase):
|
||||
'''
|
||||
Validate network module
|
||||
'''
|
||||
def test_network_ping(self):
|
||||
'''
|
||||
network.ping
|
||||
'''
|
||||
ret = self.run_function('network.ping', [URL])
|
||||
exp_out = ['ping', URL, 'ttl', 'time']
|
||||
for out in exp_out:
|
||||
self.assertIn(out, ret.lower())
|
||||
|
||||
def test_network_netstat(self):
|
||||
'''
|
||||
network.netstat
|
||||
'''
|
||||
ret = self.run_function('network.netstat')
|
||||
exp_out = ['proto', 'local-address']
|
||||
for val in ret:
|
||||
for out in exp_out:
|
||||
self.assertIn(out, val)
|
||||
|
||||
def test_network_traceroute(self):
|
||||
'''
|
||||
network.traceroute
|
||||
'''
|
||||
if not salt.utils.which('traceroute') and not salt.utils.is_windows():
|
||||
self.skipTest('traceroute not installed')
|
||||
ret = self.run_function('network.traceroute', [URL])
|
||||
exp_out = ['hostname', 'ip']
|
||||
for out in exp_out:
|
||||
self.assertIn(out, exp_out)
|
||||
|
||||
@skipIf(not salt.utils.is_windows(), 'windows only test')
|
||||
def test_network_nslookup(self):
|
||||
'''
|
||||
network.nslookup
|
||||
'''
|
||||
ret = self.run_function('network.nslookup', [URL])
|
||||
exp_out = ['Server', 'Address']
|
||||
for out in exp_out:
|
||||
self.assertIn(out, exp_out)
|
|
@ -14,6 +14,7 @@ integration.modules.test_grains
|
|||
integration.modules.test_groupadd
|
||||
integration.modules.test_hosts
|
||||
integration.modules.test_mine
|
||||
integration.modules.test_network
|
||||
integration.modules.test_pillar
|
||||
integration.modules.test_pkg
|
||||
integration.modules.test_publish
|
||||
|
|
Loading…
Add table
Reference in a new issue