Sha256: 88b25d23eb7bd9350e6a700f3e8b0aa2acbfdf0209a6297370f32c7a84c79efa

Contents?: true

Size: 1.17 KB

Versions: 57

Compression:

Stored size: 1.17 KB

Contents

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

require 'test_helper'

class FargateProcessTest < Minitest::Test
  def setup
    @subject = Instana::Snapshot::FargateProcess.new(metadata_uri: 'https://10.10.10.10:8080/v3')
  end

  def test_snapshot
    stub_request(:get, 'https://10.10.10.10:8080/v3')
      .to_return(status: 200, body: File.read('test/support/ecs/container.json'))
    stub_request(:get, 'https://10.10.10.10:8080/v3/task')
      .to_return(status: 200, body: File.read('test/support/ecs/task.json'))

    snapshot = @subject.snapshot

    assert_equal Instana::Snapshot::FargateProcess::ID, snapshot[:name]
    assert_equal Process.pid.to_s, snapshot[:entityId]

    assert_equal 'docker', snapshot[:data][:containerType]
    assert_equal '43481a6ce4842eec8fe72fc28500c6b52edcc0917f105b83379f88cac1ff3946', snapshot[:data][:container]
    assert_equal 'arn:aws:ecs:us-east-2:012345678910:task/9781c248-0edd-4cdb-9a93-f63cb662a5d3', snapshot[:data][:'com.instana.plugin.host.name']
  end

  def test_snapshot_error
    stub_request(:get, 'https://10.10.10.10:8080/v3')
      .to_return(status: 500)

    assert_raises do
      @subject.snapshot
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
instana-1.209.6 test/snapshot/fargate_process_test.rb
instana-1.209.5 test/snapshot/fargate_process_test.rb
instana-1.209.4 test/snapshot/fargate_process_test.rb
instana-1.209.3 test/snapshot/fargate_process_test.rb
instana-1.209.2 test/snapshot/fargate_process_test.rb
instana-1.209.1 test/snapshot/fargate_process_test.rb
instana-1.209.0.pre3 test/snapshot/fargate_process_test.rb
instana-1.209.0.pre2 test/snapshot/fargate_process_test.rb
instana-1.209.0.pre1 test/snapshot/fargate_process_test.rb
instana-1.208.0 test/snapshot/fargate_process_test.rb
instana-1.207.0 test/snapshot/fargate_process_test.rb
instana-1.206.0 test/snapshot/fargate_process_test.rb
instana-1.205.0 test/snapshot/fargate_process_test.rb
instana-1.204.0 test/snapshot/fargate_process_test.rb
instana-1.204.0.pre3 test/snapshot/fargate_process_test.rb
instana-1.204.0.pre2 test/snapshot/fargate_process_test.rb
instana-1.204.0.pre1 test/snapshot/fargate_process_test.rb
instana-1.203.2 test/snapshot/fargate_process_test.rb
instana-1.203.1 test/snapshot/fargate_process_test.rb
instana-1.203.0 test/snapshot/fargate_process_test.rb