Sha256: af0ddb19e8b2e4b636192e1c152018071088ddc96d7e29a7e160d8c59973113c

Contents?: true

Size: 676 Bytes

Versions: 3

Compression:

Stored size: 676 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

3 entries across 3 versions & 1 rubygems

Version Path
statsd-instrument-3.0.0 test/integration_test.rb
statsd-instrument-3.0.0.pre2 test/integration_test.rb
statsd-instrument-3.0.0.pre1 test/integration_test.rb