Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests and CHANGELOG entry for PR 1653 #1654

Merged
merged 4 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# New Relic Ruby Agent Release Notes #

## v8.14.0

Version 8.14.0 of the agent restores desired Capistrano based changelog lookup functionalty when a deployment is performed.
fallwith marked this conversation as resolved.
Show resolved Hide resolved

* **Deployment recipe: restore desired Capistrano based changelog lookup behavior**
fallwith marked this conversation as resolved.
Show resolved Hide resolved

The New Relic Ruby agent offers [a Capistrano recipe for recording app deployments](https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/record-deployments-ruby-agent/#capistrano3). The recipe code was significantly cleaned up with [PR#1498](https://github.com/newrelic/newrelic-ruby-agent/pull/1498) which inadvertently changed the way the recipe handles the changelog for a deployment. Community member [@arthurwozniak](https://github.com/arthurwozniak) spotted and corrected this change in order to restore the desired changelog lookup functionality while retaining all of the previous cleanup. Thank you very much for your contribution, [@arthurwozniak](https://github.com/arthurwozniak)! [PR#1653](https://github.com/newrelic/newrelic-ruby-agent/pull/1653)


## v8.13.1

Version 8.13.1 of the agent provides a bugfix for Redis v5.0 instrumentation.
Expand Down
59 changes: 59 additions & 0 deletions test/new_relic/recipes/helpers/send_deployment_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

require_relative '../../../test_helper'
require_relative '../../../../lib/new_relic/recipes/helpers/send_deployment'

module Newrelic
fallwith marked this conversation as resolved.
Show resolved Hide resolved
class SendDeploymentTest < MiniTest::Test
class Tester
include SendDeployment

NR_CHANGELOG = 'Rubáiyát of Omar Khayyám'
LOOKUP_CHANGELOG = 'Billborough'

def fetch(_key); end

def lookup_changelog
LOOKUP_CHANGELOG
end
end

def tester
@tester ||= Tester.new
end

def test_fetch_changelog_initial_fetch_succeeds_and_using_scm_then_use_fetched_value
tester.stub :has_scm?, true do
tester.stub :fetch, Tester::NR_CHANGELOG, [:nr_changelog] do
assert_equal Tester::NR_CHANGELOG, tester.send(:fetch_changelog)
end
end
end

def test_fetch_changelog_initial_fetch_succeeds_and_not_using_scm_then_use_fetched_value
tester.stub :has_scm?, false do
tester.stub :fetch, Tester::NR_CHANGELOG, [:nr_changelog] do
assert_equal Tester::NR_CHANGELOG, tester.send(:fetch_changelog)
end
end
end

def test_fetch_changelog_initial_fetch_fails_and_using_scm_then_perform_lookup
tester.stub :has_scm?, true do
tester.stub :fetch, nil, [:nr_changelog] do
assert_equal Tester::LOOKUP_CHANGELOG, tester.send(:fetch_changelog)
end
end
end

def test_fetch_changelog_initial_fetch_fails_and_not_using_scm_then_return_nil
tester.stub :has_scm?, false do
tester.stub :fetch, nil, [:nr_changelog] do
assert_nil tester.send(:fetch_changelog)
end
end
end
end
end