|
21 | 21 | describe JavaBuildpack::Framework::DynaTraceAgent do |
22 | 22 | include_context 'component_helper' |
23 | 23 |
|
| 24 | + let(:configuration) do |
| 25 | + { 'default_agent_name' => nil } |
| 26 | + end |
| 27 | + |
24 | 28 | it 'does not detect without dynatrace-n/a service' do |
25 | 29 | expect(component.detect).to be_nil |
26 | 30 | end |
|
45 | 49 |
|
46 | 50 | it 'updates JAVA_OPTS' do |
47 | 51 | component.release |
48 | | - expect(java_opts).to include( |
49 | | - '-agentpath:$PWD/.java-buildpack/dyna_trace_agent/agent/lib64/'\ |
| 52 | + expect(java_opts).to include('-agentpath:$PWD/.java-buildpack/dyna_trace_agent/agent/lib64/'\ |
50 | 53 | 'libdtagent.so=name=test-application-name_Monitoring,server=test-host-name') |
51 | 54 | end |
| 55 | + |
| 56 | + context do |
| 57 | + |
| 58 | + let(:configuration) { { 'default_agent_name' => 'different-agent-name' } } |
| 59 | + |
| 60 | + it 'updates JAVA_OPTS with configured agent name' do |
| 61 | + component.release |
| 62 | + expect(java_opts).to include('-agentpath:$PWD/.java-buildpack/dyna_trace_agent/agent/lib64/'\ |
| 63 | + 'libdtagent.so=name=different-agent-name,server=test-host-name') |
| 64 | + end |
| 65 | + |
| 66 | + end |
52 | 67 | end |
53 | 68 |
|
54 | 69 | context do |
55 | 70 | before do |
56 | 71 | allow(services).to receive(:one_service?).with(/dynatrace/, 'server').and_return(true) |
57 | | - allow(services).to receive(:find_service).and_return('credentials' => { 'server' => 'test-host-name', |
| 72 | + allow(services).to receive(:find_service).and_return('credentials' => { 'server' => 'test-host-name', |
58 | 73 | 'profile' => 'test-profile' }) |
59 | 74 | end |
60 | 75 |
|
61 | 76 | it 'updates JAVA_OPTS with custom profile' do |
62 | 77 | component.release |
63 | | - expect(java_opts).to include( |
64 | | - '-agentpath:$PWD/.java-buildpack/dyna_trace_agent/agent/lib64/'\ |
| 78 | + expect(java_opts).to include('-agentpath:$PWD/.java-buildpack/dyna_trace_agent/agent/lib64/'\ |
65 | 79 | 'libdtagent.so=name=test-application-name_test-profile,server=test-host-name') |
66 | 80 | end |
67 | 81 |
|
|
0 commit comments