Sha256: 6f1e5f95e08738de4a7ef367478fce432877aa9a7d58758ece96718fdd5b4830

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

gem 'minitest'

require 'minitest/autorun'
require 'bib/opsworks/newrelic'

class NewrelicTest < Minitest::Test
  def test_publish_deployment
    newrelic = Bib::Opsworks::Newrelic.new

    deploy_data = {
      'deploying_user' => 'arn:aws:iam::123456:user/gemtest',
      'scm' => {
        'revision' => 'rev1'
      }
    }
    app_name = 'unittest'

    result = newrelic.prepare_publishing_data(app_name, deploy_data)
    expected = {
      'deployment[app_name]' => 'unittest',
      'deployment[user]' => 'gemtest',
      'deployment[revision]' => 'rev1'
    }
    assert_equal(expected, result)
  end

  def test_publish_deployment_nouser
    newrelic = Bib::Opsworks::Newrelic.new

    deploy_data = { 'scm' => { 'revision' => 'rev1' } }
    app_name = 'unittest'

    result = newrelic.prepare_publishing_data(app_name, deploy_data)
    expected = {
      'deployment[app_name]' => 'unittest',
      'deployment[user]' => 'opsworks',
      'deployment[revision]' => 'rev1'
    }
    assert_equal(expected, result)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
BibOpsworks-0.2.0 tests/newrelic_test.rb
BibOpsworks-0.1.8 tests/newrelic_test.rb
BibOpsworks-0.1.7 tests/newrelic_test.rb
BibOpsworks-0.1.6 tests/newrelic_test.rb
BibOpsworks-0.1.5 tests/newrelic_test.rb
BibOpsworks-0.1.4 tests/newrelic_test.rb
BibOpsworks-0.1.3 tests/newrelic_test.rb