Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/java_buildpack/framework/dyna_trace_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def agent_path
end

def agent_name
"#{@application.details['application_name']}_#{profile_name}"
ENV['JBP_CONFIG_DYNATRACE_AGENT_NAME'] || "#{@application.details['application_name']}_#{profile_name}"
end

def architecture
Expand Down
19 changes: 19 additions & 0 deletions spec/java_buildpack/framework/dyna_trace_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,23 @@
end

end

context do

let(:environment) { { 'JBP_CONFIG_DYNATRACE_AGENT_NAME' => 'environment-set-application-name' } }

before do
allow(services).to receive(:one_service?).with(/dynatrace/, 'server').and_return(true)
allow(services).to receive(:find_service).and_return('credentials' => { 'server' => 'test-host-name' })
end

it 'updates JAVA_OPTS with custom environment variable' do
component.release
expect(java_opts).to include(
'-agentpath:$PWD/.java-buildpack/dyna_trace_agent/agent/lib64/'\
'libdtagent.so=name=environment-set-application-name,server=test-host-name')
end

end

end