Sha256: d47f2c331d36ee70488b89892c9fe4a26faf85796eef50ed2580a3f621c90214

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class IntegrationTest < Minitest::Test
  def setup
    @server = UDPSocket.new
    @server.bind('localhost', 0)

    @env = StatsD::Instrument::Environment.new(
      'STATSD_ADDR' => "#{@server.addr[2]}:#{@server.addr[1]}",
      'STATSD_IMPLEMENTATION' => 'dogstatsd',
      'STATSD_ENV' => 'production',
    )

    @old_client = StatsD.singleton_client
    StatsD.singleton_client = @env.client
  end

  def teardown
    StatsD.singleton_client = @old_client
    @server.close
  end

  def test_live_local_udp_socket
    StatsD.increment('counter')
    assert_equal("counter:1|c", @server.recvfrom(100).first)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
statsd-instrument-3.0.2 test/integration_test.rb
statsd-instrument-3.0.1 test/integration_test.rb