infinite_tracing/test/support/fake_trace_observer_helpers.rb
# We really shouldn't have to sleep, but this workaround gets us past
# various intermittent failing tests.  At the core of this issue is that
# in the agent_integrations/agent, we call Client.start_streaming in a thread
# This is the thread that lingers in "run" state alongside our active test runner.
# Various attempts to join or explicitly kill this thread led to more errors
# rather than fewer.  On the other hand, simply sleeping when there's more than
# one Thread in a "run" state solves the issues altogether.
We really shouldn't have to sleep, but this workaround gets us past
various intermittent failing tests.  At the core of this issue is that
in the agent_integrations/agent, we call Client.start_streaming in a thread
This is the thread that lingers in "run" state alongside our active test runner.
Various attempts to join or explicitly kill this thread led to more errors
rather than fewer.  On the other hand, simply sleeping when there's more than
one Thread in a "run" state solves the issues altogether.
We really shouldn ' t have to sleep but this workaround gets us past various intermittent failing tests . At the core of this issue is that in the agent_integrations / agent we call Client . start_streaming in a thread This is the thread that lingers in " run " state alongside our active test runner . Various attempts to join or explicitly kill this thread led to more errors rather than fewer . On the other hand simply sleeping when there ' s more than one Thread in a " run " state solves the issues altogether .
def wait_for_agent_infinite_tracer_thread_to_close
              timeout_cap(3.0) do
                while Thread.list.select{|t| t.status == "run"}.size > 1
                  sleep(0.01)
                end
                sleep(0.01)
              end
            end
def wait_for_agent_infinite_tracer_thread_to_close timeout_cap ( 3.0 ) do while Thread . list . select { | t | t . status == "run" } . size > 1 sleep ( 0.01 ) end sleep ( 0.01 ) end end
We really shouldn't have to sleep, but this workaround gets us past
various intermittent failing tests.
We really shouldn ' t have to sleep but this workaround gets us past various intermittent failing tests .