File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed
Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -187,13 +187,6 @@ executors:
187187 docker :
188188 - image : cimg/ruby:3.3-node
189189commands :
190- setup_iproute2 :
191- steps :
192- - run :
193- name : Install iproute2
194- command : |
195- sudo apt-get update
196- sudo apt-get install iproute2
197190 setup :
198191 steps :
199192 - run :
@@ -296,7 +289,6 @@ jobs:
296289 executor : << parameters.stack >>
297290 steps :
298291 - checkout
299- - setup_iproute2
300292 - setup
301293 - run_tests
302294 test_apprisal :
Original file line number Diff line number Diff line change 66class HostAgentTest < Minitest ::Test
77 def test_spawn_background_thread
88 ENV [ 'INSTANA_TEST' ] = nil
9- ::Instana . config [ :agent_host ] = '10.10.10.10'
9+ agent_host = '10.10.10.10'
10+ ::Instana . config [ :agent_host ] = agent_host
1011
11- if File . exist? ( '/sbin/ip' )
12- addr = `/sbin/ip route | awk '/default/ { print $3 }'` . strip
12+ if File . exist? ( '/proc/net/route' )
13+ default_gateway_hex = lambda {
14+ File . open ( '/proc/net/route' , 'r' ) do |file |
15+ file . each_line do |line |
16+ columns = line . split ( "\t " )
17+ if columns [ 1 ] == '00000000' && columns [ 1 ] == columns [ 7 ]
18+ return columns [ 2 ]
19+ end
20+ end
21+ end
22+ } . call
23+
24+ addr = default_gateway_hex . scan ( /.{2}/ ) . map ( &:hex ) . reverse . join ( '.' )
1325 stub_request ( :get , "http://#{ addr } :42699/" )
1426 . to_timeout
1527 end
1628
17- stub_request ( :get , "http://10.10.10.10 :42699/" )
29+ stub_request ( :get , "http://#{ agent_host } :42699/" )
1830 . to_timeout . times ( 3 ) . then
1931 . to_return ( status : 200 , body : "" , headers : { } )
2032
You can’t perform that action at this time.
0 commit comments