Sha256: 607487301835c93c4101861043fd24b86d70e0fab460c48b20b084fffb19238d

Contents?: true

Size: 1.4 KB

Versions: 64

Compression:

Stored size: 1.4 KB

Contents


# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2016

require 'test_helper'
require 'rack/test'

class RodaTest < Minitest::Test
  include Rack::Test::Methods
  APP = Rack::Builder.parse_file('test/support/apps/roda/config.ru').first

  def app
    APP
  end

  def test_basic_get
    clear_all!

    r = get '/hello'
    assert last_response.ok?

    assert r.headers.key?("X-Instana-T")
    assert r.headers.key?("X-Instana-S")

    spans = ::Instana.processor.queued_spans
    assert_equal 1, spans.count

    first_span = spans.first
    assert_equal :rack, first_span[:n]
    assert first_span.key?(:data)
    assert first_span[:data].key?(:http)

    assert first_span[:data][:http].key?(:method)
    assert_equal "GET", first_span[:data][:http][:method]

    assert first_span[:data][:http].key?(:url)
    assert_equal "/hello", first_span[:data][:http][:url]

    assert first_span[:data][:http].key?(:status)
    assert_equal 200, first_span[:data][:http][:status]

    assert first_span[:data][:http].key?(:host)
    assert_equal "example.org", first_span[:data][:http][:host]
  end

  def test_path_template
    clear_all!

    r = get '/greet/instana'
    assert last_response.ok?

    spans = ::Instana.processor.queued_spans
    assert_equal 1, spans.count

    first_span = spans.first
    assert_equal :rack, first_span[:n]
    assert_equal '/greet/{name}', first_span[:data][:http][:path_tpl]
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
instana-1.202.0 test/frameworks/roda_test.rb
instana-1.201.0 test/frameworks/roda_test.rb
instana-1.201.0.pre1 test/frameworks/roda_test.rb
instana-1.200.0 test/frameworks/roda_test.rb
instana-1.200.0.pre1 test/frameworks/roda_test.rb
instana-1.199.6 test/frameworks/roda_test.rb
instana-1.199.5 test/frameworks/roda_test.rb
instana-1.199.4 test/frameworks/roda_test.rb
instana-1.199.3 test/frameworks/roda_test.rb
instana-1.199.2 test/frameworks/roda_test.rb
instana-1.199.1 test/frameworks/roda_test.rb
instana-1.199.0 test/frameworks/roda_test.rb
instana-1.198.0 test/frameworks/roda_test.rb
instana-1.198.0.pre1 test/frameworks/roda_test.rb
instana-1.197.0 test/frameworks/roda_test.rb
instana-1.197.0.pre2 test/frameworks/roda_test.rb
instana-1.197.0.pre1 test/frameworks/roda_test.rb
instana-1.195.4 test/frameworks/roda_test.rb
instana-1.195.3 test/frameworks/roda_test.rb
instana-1.195.2 test/frameworks/roda_test.rb