I was having problems with sporadic output from the tests, e.g.
rake TESTOPTS="--seed=46384" test
Run options: --seed=46384
# Running:
............................................/opt/rubies/ruby-3.1.4-pshopify1/lib/ruby/3.1.0/psych/nodes/scalar.rb:65: warning: Exception in finalizer #<Proc:0x
00007f76b40897d8 /home/spin/src/github.com/Shopify/statsd-instrument/lib/statsd/instrument/udp_sink.rb:17 (lambda)>
/home/spin/src/github.com/Shopify/statsd-instrument/lib/statsd/instrument/udp_sink.rb:20:in `block (2 levels) in <class:UDPSink>': #<Mock:socket> was instantia
ted in one test but it is receiving invocations within another test. This can lead to unintended interactions between tests and hence unexpected test failures.
Ensure that every test correctly cleans up any state that it introduces. (Mocha::StubbingError)
from /home/spin/src/github.com/Shopify/statsd-instrument/lib/statsd/instrument/udp_sink.rb:18:in `each'
from /home/spin/src/github.com/Shopify/statsd-instrument/lib/statsd/instrument/udp_sink.rb:18:in `block in <class:UDPSink>'
from /opt/rubies/ruby-3.1.4-pshopify1/lib/ruby/3.1.0/psych/nodes/scalar.rb:65:in `initialize'
from /opt/rubies/ruby-3.1.4-pshopify1/lib/ruby/3.1.0/psych/tree_builder.rb:97:in `new'
from /opt/rubies/ruby-3.1.4-pshopify1/lib/ruby/3.1.0/psych/tree_builder.rb:97:in `scalar'
...
I think this could be because the mock socket doesn't necessarily get cleaned up right away after the UDP sink tests execute.
I also added an expectation for the environment test mainly to avoid that warning from spamming the console every time tests are run.
I was having problems with sporadic output from the tests, e.g.
I think this could be because the mock socket doesn't necessarily get cleaned up right away after the UDP sink tests execute.
I also added an expectation for the environment test mainly to avoid that warning from spamming the console every time tests are run.