Sha256: 2efb9435ea44e65a374518ebcda1691a42ba374aa92641af28951c64782b1598

Contents?: true

Size: 677 Bytes

Versions: 24

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

24 entries across 24 versions & 1 rubygems

Version Path
statsd-instrument-3.2.0 test/integration_test.rb
statsd-instrument-3.1.2 test/integration_test.rb
statsd-instrument-3.1.1 test/integration_test.rb
statsd-instrument-3.1.0 test/integration_test.rb