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.8.0 test/integration_test.rb
statsd-instrument-3.7.0 test/integration_test.rb
statsd-instrument-3.6.1 test/integration_test.rb
statsd-instrument-3.6.0 test/integration_test.rb
statsd-instrument-3.5.12 test/integration_test.rb
statsd-instrument-3.5.11 test/integration_test.rb
statsd-instrument-3.5.10 test/integration_test.rb
statsd-instrument-3.5.9 test/integration_test.rb
statsd-instrument-3.5.8 test/integration_test.rb
statsd-instrument-3.5.7 test/integration_test.rb
statsd-instrument-3.5.6 test/integration_test.rb
statsd-instrument-3.5.5 test/integration_test.rb
statsd-instrument-3.5.4 test/integration_test.rb
statsd-instrument-3.5.3 test/integration_test.rb
statsd-instrument-3.5.2 test/integration_test.rb
statsd-instrument-3.5.1 test/integration_test.rb
statsd-instrument-3.5.0 test/integration_test.rb
statsd-instrument-3.4.0 test/integration_test.rb
statsd-instrument-3.3.0 test/integration_test.rb
statsd-instrument-3.2.1 test/integration_test.rb