docker - Ruby misses XPath expression when listening on interface -
for api-testing listening on interface sends messages every second. on lokal machine tests run fine. have eightcore processor 16gb of ram. when running test in dockercontainer on machine still fine. (i ran tests 3000 times - good) put docker container on different host (2 core 6 gb - 2 gb used tests) of tests fail sometimes. happens quite - every 15th iteration or so.
now wondering cause.
here code snippet. sorry - not s.o.l.i.d. ... i'm still learning :-)
def wait_for(xpath_exp, timeout=$timeout) puts 'waiting xpath-expression' begin timeout::timeout(timeout) $logger.info "#{@name} waiting #{timeout} seconds message satisfying '#{xpath_exp}'" loop puts 'waiting message' msg = @connection.gets(0x4.chr).chomp(0x4.chr) doc = nokogiri::xml(msg) if not doc.xpath(xpath_exp).empty? $logger.info "#{@name} encountered message matching '#{xpath_exp}': #{msg}'" @@result = 0 return doc end end end rescue exception => e $logger.error e $logger.error "waited '#{xpath_exp}' - no messages received - timed out after #{timeout} seconds." $logger.error "terminating." process.exit(1) end end
sorry - found out nothing in code above wrong. timeout somewhere else in tests made tests quit before time...
Comments
Post a Comment