@@ -180,7 +180,7 @@ var _ = Describe("CfJavaPlugin", func() {
180
180
Expect (cliOutput ).To (Equal ("" ))
181
181
182
182
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (1 ))
183
- Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--command" , JavaDetectionCommand + "$( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) > /dev/null ; cat /tmp/heapdump-abcd-123456.hprof; rm -f /tmp/heapdump-abcd-123456.hprof" }))
183
+ Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--command" , JavaDetectionCommand + "; if [ -f /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 'Heap dump /tmp/heapdump-abcd-123456.hprof already exists'; exit 1; fi; OUTPUT=$( $( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) ) || STATUS_CODE=$?; if [ ! -s /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 ${OUTPUT}; exit 1; fi; if [ ${STATUS_CODE:-0} -gt 0 ]; then echo >&2 ${OUTPUT}; exit ${STATUS_CODE}; fi ; cat /tmp/heapdump-abcd-123456.hprof; rm -f /tmp/heapdump-abcd-123456.hprof" }))
184
184
})
185
185
186
186
})
@@ -200,7 +200,7 @@ var _ = Describe("CfJavaPlugin", func() {
200
200
Expect (cliOutput ).To (Equal ("" ))
201
201
202
202
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (1 ))
203
- Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--app-instance-index" , "4" , "--command" , JavaDetectionCommand + "$( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) > /dev/null ; cat /tmp/heapdump-abcd-123456.hprof; rm -f /tmp/heapdump-abcd-123456.hprof" }))
203
+ Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--app-instance-index" , "4" , "--command" , JavaDetectionCommand + "; if [ -f /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 'Heap dump /tmp/heapdump-abcd-123456.hprof already exists'; exit 1; fi; OUTPUT=$( $( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) ) || STATUS_CODE=$?; if [ ! -s /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 ${OUTPUT}; exit 1; fi; if [ ${STATUS_CODE:-0} -gt 0 ]; then echo >&2 ${OUTPUT}; exit ${STATUS_CODE}; fi ; cat /tmp/heapdump-abcd-123456.hprof; rm -f /tmp/heapdump-abcd-123456.hprof" }))
204
204
})
205
205
206
206
})
@@ -220,7 +220,7 @@ var _ = Describe("CfJavaPlugin", func() {
220
220
Expect (cliOutput ).To (Equal ("" ))
221
221
222
222
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (1 ))
223
- Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--app-instance-index" , "4" , "--command" , JavaDetectionCommand + "$( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) > /dev/null ; cat /tmp/heapdump-abcd-123456.hprof" }))
223
+ Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--app-instance-index" , "4" , "--command" , JavaDetectionCommand + "; if [ -f /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 'Heap dump /tmp/heapdump-abcd-123456.hprof already exists'; exit 1; fi; OUTPUT=$( $( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) ) || STATUS_CODE=$?; if [ ! -s /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 ${OUTPUT}; exit 1; fi; if [ ${STATUS_CODE:-0} -gt 0 ]; then echo >&2 ${OUTPUT}; exit ${STATUS_CODE}; fi ; cat /tmp/heapdump-abcd-123456.hprof" }))
224
224
})
225
225
226
226
})
@@ -235,9 +235,9 @@ var _ = Describe("CfJavaPlugin", func() {
235
235
return output , err
236
236
})
237
237
238
- Expect (output ).To (Equal ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "$( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) > /dev/null ; cat /tmp/heapdump-abcd-123456.hprof'" ))
238
+ Expect (output ).To (Equal ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "; if [ -f /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 'Heap dump /tmp/heapdump-abcd-123456.hprof already exists'; exit 1; fi; OUTPUT=$( $( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) ) || STATUS_CODE=$?; if [ ! -s /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 ${OUTPUT}; exit 1; fi; if [ ${STATUS_CODE:-0} -gt 0 ]; then echo >&2 ${OUTPUT}; exit ${STATUS_CODE}; fi ; cat /tmp/heapdump-abcd-123456.hprof'" ))
239
239
Expect (err ).To (BeNil ())
240
- Expect (cliOutput ).To (ContainSubstring ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "$( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) > /dev/null ; cat /tmp/heapdump-abcd-123456.hprof'" ))
240
+ Expect (cliOutput ).To (ContainSubstring ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "; if [ -f /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 'Heap dump /tmp/heapdump-abcd-123456.hprof already exists'; exit 1; fi; OUTPUT=$( $( find -executable -name jmap | head -1) -dump:format=b,file=/tmp/heapdump-abcd-123456.hprof $(pidof java) ) || STATUS_CODE=$?; if [ ! -s /tmp/heapdump-abcd-123456.hprof ]; then echo >&2 ${OUTPUT}; exit 1; fi; if [ ${STATUS_CODE:-0} -gt 0 ]; then echo >&2 ${OUTPUT}; exit ${STATUS_CODE}; fi ; cat /tmp/heapdump-abcd-123456.hprof'" ))
241
241
242
242
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (0 ))
243
243
})
@@ -303,7 +303,7 @@ var _ = Describe("CfJavaPlugin", func() {
303
303
Expect (cliOutput ).To (Equal ("" ))
304
304
305
305
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (1 ))
306
- Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--command" , JavaDetectionCommand + "$(find -executable -name jstack | head -1) $(pidof java)" }))
306
+ Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--command" , JavaDetectionCommand + "; $(find -executable -name jstack | head -1) $(pidof java)" }))
307
307
})
308
308
309
309
})
@@ -323,7 +323,7 @@ var _ = Describe("CfJavaPlugin", func() {
323
323
Expect (cliOutput ).To (Equal ("" ))
324
324
325
325
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (1 ))
326
- Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--app-instance-index" , "4" , "--command" , JavaDetectionCommand + "$(find -executable -name jstack | head -1) $(pidof java)" }))
326
+ Expect (commandExecutor .ExecuteArgsForCall (0 )).To (Equal ([]string {"ssh" , "my_app" , "--app-instance-index" , "4" , "--command" , JavaDetectionCommand + "; $(find -executable -name jstack | head -1) $(pidof java)" }))
327
327
})
328
328
329
329
})
@@ -358,9 +358,9 @@ var _ = Describe("CfJavaPlugin", func() {
358
358
return output , err
359
359
})
360
360
361
- Expect (output ).To (Equal ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "$(find -executable -name jstack | head -1) $(pidof java)'" ))
361
+ Expect (output ).To (Equal ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "; $(find -executable -name jstack | head -1) $(pidof java)'" ))
362
362
Expect (err ).To (BeNil ())
363
- Expect (cliOutput ).To (ContainSubstring ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "$(find -executable -name jstack | head -1) $(pidof java)'" ))
363
+ Expect (cliOutput ).To (ContainSubstring ("cf ssh my_app --app-instance-index 4 --command '" + JavaDetectionCommand + "; $(find -executable -name jstack | head -1) $(pidof java)'" ))
364
364
365
365
Expect (commandExecutor .ExecuteCallCount ()).To (Equal (0 ))
366
366
})
0 commit comments