Sha256: f65ba776fdec6cd18a8b07bf0974d090114f9a6015e2691e10ccdf0d5db0ea25

Contents?: true

Size: 1.08 KB

Versions: 52

Compression:

Stored size: 1.08 KB

Contents

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

require 'test_helper'

class GoogleCloudRunProcessTest < Minitest::Test
  def test_snapshot
    ENV['K_REVISION'] = 'test'
    stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
      .to_return(status: 200, body: 'test_instance_id')

    subject = Instana::Snapshot::GoogleCloudRunProcess.new(metadata_uri: 'http://10.10.10.10/')
    snapshot = subject.snapshot

    assert_equal Instana::Snapshot::GoogleCloudRunProcess::ID, snapshot[:name]
    assert_equal 'test_instance_id', snapshot[:data][:container]
    assert_equal 'gcpCloudRunInstance', snapshot[:data][:containerType]
    assert_equal 'gcp:cloud-run:revision:test', snapshot[:data][:'com.instana.plugin.host.name']
  ensure
    ENV['K_REVISION'] = nil
  end

  def test_snapshot_error
    stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
      .to_return(status: 500)

    subject = Instana::Snapshot::GoogleCloudRunProcess.new(metadata_uri: 'http://10.10.10.10/')

    assert_raises do
      subject.snapshot
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
instana-1.217.1 test/snapshot/google_cloud_run_process_test.rb
instana-1.217.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.216.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.215.1 test/snapshot/google_cloud_run_process_test.rb
instana-1.215.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.214.4 test/snapshot/google_cloud_run_process_test.rb
instana-1.214.3 test/snapshot/google_cloud_run_process_test.rb
instana-1.214.2 test/snapshot/google_cloud_run_process_test.rb
instana-1.214.1 test/snapshot/google_cloud_run_process_test.rb
instana-1.214.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.213.3 test/snapshot/google_cloud_run_process_test.rb
instana-1.213.2 test/snapshot/google_cloud_run_process_test.rb
instana-1.213.1 test/snapshot/google_cloud_run_process_test.rb
instana-1.213.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.212.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.211.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.210.1 test/snapshot/google_cloud_run_process_test.rb
instana-1.210.0 test/snapshot/google_cloud_run_process_test.rb
instana-1.209.8 test/snapshot/google_cloud_run_process_test.rb
instana-1.209.7 test/snapshot/google_cloud_run_process_test.rb