Sha256: 1a2673d69409f53658d63261bcac7bb4bbb488840c94c3f17a2322cfc907aa74

Contents?: true

Size: 1.11 KB

Versions: 88

Compression:

Stored size: 1.11 KB

Contents

if defined?(::Sinatra)
  require 'test_helper'
  require File.expand_path(File.dirname(__FILE__) + '/../apps/sinatra')
  require 'rack/test'

  class SinatraTest < Minitest::Test
    include Rack::Test::Methods

    def app
      InstanaSinatraApp
    end

    def test_basic_get
      clear_all!

      r = get '/'
      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 "/", 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
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
instana-1.11.6 test/frameworks/sinatra_test.rb
instana-1.11.6-java test/frameworks/sinatra_test.rb
instana-1.11.5 test/frameworks/sinatra_test.rb
instana-1.11.5-java test/frameworks/sinatra_test.rb
instana-1.11.4-java test/frameworks/sinatra_test.rb
instana-1.11.4 test/frameworks/sinatra_test.rb
instana-1.11.3-java test/frameworks/sinatra_test.rb
instana-1.11.3 test/frameworks/sinatra_test.rb
instana-1.11.2-java test/frameworks/sinatra_test.rb
instana-1.11.2 test/frameworks/sinatra_test.rb
instana-1.11.1-java test/frameworks/sinatra_test.rb
instana-1.11.1 test/frameworks/sinatra_test.rb
instana-1.11.0-java test/frameworks/sinatra_test.rb
instana-1.11.0 test/frameworks/sinatra_test.rb
instana-1.10.10 test/frameworks/sinatra_test.rb
instana-1.10.10-java test/frameworks/sinatra_test.rb
instana-1.10.9-java test/frameworks/sinatra_test.rb
instana-1.10.9 test/frameworks/sinatra_test.rb
instana-1.10.8-java test/frameworks/sinatra_test.rb
instana-1.10.8 test/frameworks/sinatra_test.rb