Skip to content

Commit

Permalink
[aws] update AWS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Palazzetti committed Sep 20, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent a8c2f29 commit 585ccbc
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions test/contrib/aws/instrumentation_test.rb
Original file line number Diff line number Diff line change
@@ -9,37 +9,38 @@ module Contrib
module Aws
class InstrumentationTest < Minitest::Test
def setup
# initializes the tracer and a stub client
@tracer = enable_tracer
client = ::Aws::S3::Client.new(stub_responses: true)
client.list_buckets

@span = @tracer.writer.spans.find { |span| span.resource == RESOURCE }
end

def test_span_name
assert_equal('s3.list_buckets', @span.name)
@client = ::Aws::S3::Client.new(stub_responses: true)
end

def test_span_service
assert_equal(pin.service, @span.service)
def test_pin_defaults
assert_equal('aws', pin.service)
assert_equal('web', pin.app_type)
assert_nil(pin.app)
assert_nil(pin.name)
assert_nil(pin.config)
end

def test_span_type
assert_equal(pin.app_type, @span.span_type)
end

def test_span_resource
assert_equal('aws.command', @span.resource)
end
def test_list_buckets
@client.list_buckets
spans = @tracer.writer.spans
assert_equal(1, spans.length)
aws_span = spans[0]

def test_span_tags
assert_equal('aws-sdk-ruby', @span.get_tag('aws.agent'))
assert_equal('list_buckets', @span.get_tag('aws.operation'))
assert_equal('us-stubbed-1', @span.get_tag('aws.region'))
assert_equal('/', @span.get_tag('path'))
assert_equal('s3.us-stubbed-1.amazonaws.com', @span.get_tag('host'))
assert_equal('GET', @span.get_tag(Datadog::Ext::HTTP::METHOD))
assert_equal('200', @span.get_tag(Datadog::Ext::HTTP::STATUS_CODE))
# check Span attributes
assert_equal('s3.list_buckets', aws_span.name)
assert_equal('aws', aws_span.service)
assert_equal('web', aws_span.span_type)
assert_equal('aws.command', aws_span.resource)
# check Span tags
assert_equal('aws-sdk-ruby', aws_span.get_tag('aws.agent'))
assert_equal('list_buckets', aws_span.get_tag('aws.operation'))
assert_equal('us-stubbed-1', aws_span.get_tag('aws.region'))
assert_equal('/', aws_span.get_tag('path'))
assert_equal('s3.us-stubbed-1.amazonaws.com', aws_span.get_tag('host'))
assert_equal('GET', aws_span.get_tag('http.method'))
assert_equal('200', aws_span.get_tag('http.status_code'))
end

def test_client_response

0 comments on commit 585ccbc

Please sign in to comment.