@@ -30,7 +30,7 @@ def highest_port(service, base_port, *kinds):
3030class TestTcpInputNameHandling (testlib .SDKTestCase ):
3131 def setUp (self ):
3232 super (TestTcpInputNameHandling , self ).setUp ()
33- self .base_port = highest_port (self .service , 10000 , 'tcp' , 'splunktcp' ) + 1
33+ self .base_port = highest_port (self .service , 10000 , 'tcp' , 'splunktcp' , 'udp' ) + 1
3434
3535 def tearDown (self ):
3636 for input in self .service .inputs .list ('tcp' , 'splunktcp' ):
@@ -62,7 +62,7 @@ def test_remove_host_restriction(self):
6262 input .delete ()
6363
6464 def test_create_tcp_ports_with_restrictToHost (self ):
65- for kind in ['tcp' , 'splunktcp' ]:
65+ for kind in ['tcp' , 'splunktcp' ]: # Multiplexed UDP ports are not supported
6666 # Make sure we can create two restricted inputs on the same port
6767 boris = self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'boris' )
6868 natasha = self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'natasha' )
@@ -75,25 +75,27 @@ def test_create_tcp_ports_with_restrictToHost(self):
7575 natasha .delete ()
7676
7777 def test_restricted_to_unrestricted_collision (self ):
78- for kind in ['tcp' , 'splunktcp' ]:
78+ for kind in ['tcp' , 'splunktcp' , 'udp' ]:
7979 restricted = self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'boris' )
80+ self .assertTrue ('boris:' + str (self .base_port ) in self .service .inputs )
8081 self .assertRaises (
8182 client .HTTPError ,
8283 lambda : self .service .inputs .create (kind , str (self .base_port ))
8384 )
8485 restricted .delete ()
8586
8687 def test_unrestricted_to_restricted_collision (self ):
87- for kind in ['tcp' , 'splunktcp' ]:
88+ for kind in ['tcp' , 'splunktcp' , 'udp' ]:
8889 unrestricted = self .service .inputs .create (kind , str (self .base_port ))
90+ self .assertTrue (str (self .base_port ) in self .service .inputs )
8991 self .assertRaises (
9092 client .HTTPError ,
91- lambda : self .service .inputs .create (kind , str (self .base_port ), restrictToHos = 'boris' )
93+ lambda : self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'boris' )
9294 )
9395 unrestricted .delete ()
9496
9597 def test_update_restrictToHost (self ):
96- for kind in ['tcp' , 'splunktcp' ]:
98+ for kind in ['tcp' , 'splunktcp' ]: # No UDP, since it's broken in Splunk
9799 port = self .base_port
98100 while True : # Find the next unbound port
99101 try :
@@ -123,7 +125,7 @@ def test_update_restrictToHost(self):
123125 boris .delete ()
124126
125127 def test_update_nonrestrictToHost (self ):
126- for kind in ['tcp' , 'splunktcp' ]:
128+ for kind in ['tcp' , 'splunktcp' ]: # No UDP since it's broken in Splunk
127129 port = self .base_port
128130 while True : # Find the next unbound port
129131 try :
0 commit comments