Sha256: 79f8da1c6376d55e291e2c6da7a357a885893db720e8e639cea6999fbab9b6e2

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'fake_rpm_site'
require 'multiverse_helpers'

class DeploymentTest < Minitest::Test
  def setup
    $rpm_site ||= NewRelic::FakeRpmSite.new
    $rpm_site.reset
    $rpm_site.run
  end

  def test_deploys_to_configured_application
    cap_it
    assert_deployment_value("application_id", "test")
  end

  def test_deploys_with_commandline_parameter
    cap_it("-s newrelic_user=someone -s newrelic_appname=somewhere")
    assert_deployment_value("user",           "someone")
    assert_deployment_value("application_id", "somewhere")
  end

  def assert_deployment_value(key, value)
    assert_equal(1, $rpm_site.requests.count)
    assert_equal(value, $rpm_site.requests.first["deployment"][key])
  end

  def cap_it(options="")
    cmd = "cap newrelic:notice_deployment #{options}"
    output = with_environment('FAKE_RPM_SITE_PORT' => $rpm_site.port.to_s) do
      `#{cmd}`
    end
    assert $?.success?, "cap command '#{cmd}' failed with output: #{output}"
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-3.10.0.279 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.9.275 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.8.273 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.7.266 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.6.257 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.5.251 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.4.245 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.3.241 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.2.239 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.1.236 test/multiverse/suites/capistrano2/deployment_test.rb
newrelic_rpm-3.9.0.229 test/multiverse/suites/capistrano2/deployment_test.rb