@@ -180,7 +180,7 @@ var _ = Describe("CfJavaPlugin", func() {
180180 Expect (cliOutput ).To (Equal ("" ))
181181
182182 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" }))
184184 })
185185
186186 })
@@ -200,7 +200,7 @@ var _ = Describe("CfJavaPlugin", func() {
200200 Expect (cliOutput ).To (Equal ("" ))
201201
202202 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" }))
204204 })
205205
206206 })
@@ -220,7 +220,7 @@ var _ = Describe("CfJavaPlugin", func() {
220220 Expect (cliOutput ).To (Equal ("" ))
221221
222222 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" }))
224224 })
225225
226226 })
@@ -235,9 +235,9 @@ var _ = Describe("CfJavaPlugin", func() {
235235 return output , err
236236 })
237237
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'" ))
239239 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'" ))
241241
242242 Expect (commandExecutor .ExecuteCallCount ()).To (Equal (0 ))
243243 })
@@ -303,7 +303,7 @@ var _ = Describe("CfJavaPlugin", func() {
303303 Expect (cliOutput ).To (Equal ("" ))
304304
305305 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)" }))
307307 })
308308
309309 })
@@ -323,7 +323,7 @@ var _ = Describe("CfJavaPlugin", func() {
323323 Expect (cliOutput ).To (Equal ("" ))
324324
325325 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)" }))
327327 })
328328
329329 })
@@ -358,9 +358,9 @@ var _ = Describe("CfJavaPlugin", func() {
358358 return output , err
359359 })
360360
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)'" ))
362362 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)'" ))
364364
365365 Expect (commandExecutor .ExecuteCallCount ()).To (Equal (0 ))
366366 })
0 commit comments