Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Chabert committed Sep 11, 2023
1 parent 74037ec commit de3600b
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions test/aws-xray-sdk/tc_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_get_runtime_context
WebMock.reset!
end

# EC2 Plugin
def test_ec2_metadata_v2_successful
dummy_json = '{\"availabilityZone\" : \"us-east-2a\", \"imageId\" : \"ami-03cca83dd001d4666\",
\"instanceId\" : \"i-07a181803de94c666\", \"instanceType\" : \"t3.xlarge\"}'
Expand Down Expand Up @@ -85,21 +86,7 @@ def test_ec2_metadata_fail
WebMock.reset!
end

def test_get_runtime_context
XRay::Plugins::ElasticBeanstalk.aws
stub_request(:any, XRay::Plugins::EC2::METADATA_BASE_URL + '/api/token')
.to_raise(StandardError)
stub_request(:any, XRay::Plugins::EC2::METADATA_BASE_URL + '/dynamic/instance-identity/document')
.to_raise(StandardError)
stub_request(:any, XRay::Plugins::ECS::METADATA_BASE_URL + '/api/token')
.to_raise(StandardError)
stub_request(:any, XRay::Plugins::ECS::METADATA_BASE_URL + '/dynamic/instance-identity/document')
.to_raise(StandardError)
XRay::Plugins::EC2.aws
XRay::Plugins::ECS.aws
WebMock.reset!
end

# ECS Plugin
def test_ecs_metadata_v2_successful
dummy_json = '{\"availabilityZone\" : \"us-east-2a\", \"imageId\" : \"ami-03cca83dd001d4666\",
\"instanceId\" : \"i-07a181803de94c666\", \"instanceType\" : \"t3.xlarge\"}'
Expand Down Expand Up @@ -143,7 +130,7 @@ def test_ecs_metadata_v1_successful
assert expected, XRay::Plugins::ECS.aws
WebMock.reset!
end

def test_ecs_metadata_fail
stub_request(:put, XRay::Plugins::ECS::METADATA_BASE_URL + '/api/token')
.to_raise(StandardError)
Expand Down

0 comments on commit de3600b

Please sign in to comment.