@@ -14,48 +14,73 @@ send_envelope() {
1414 echo " Test Sending $1 "
1515}
1616
17+ # #########################
18+
1719export -f send_envelope
1820echo " Testing initial send_event"
1921export log_file=test_log.txt
2022echo " Test Logs" > " $log_file "
2123echo " Error Msg" >> " $log_file "
2224breadcrumbs=$( generate_breadcrumb_json | sed ' $d' | $jq -s -c)
23- SEND_EVENT_RESPONSE=$( send_event " 12345123451234512345123451234512" " Test exited with status 1" " {\" ignore\" : \" me\" }" " $breadcrumbs " )
25+ SEND_EVENT_RESPONSE=$(
26+ send_event \
27+ " 'foo' exited with status 1" \
28+ " Test exited with status 1" \
29+ " Traceback: ignore me" \
30+ " {\" ignore\" : \" me\" }" \
31+ " $breadcrumbs "
32+ )
2433rm " $log_file "
25- test " $SEND_EVENT_RESPONSE " == ' Test Sending sentry-envelope-12345123451234512345123451234512'
26- ENVELOPE_CONTENTS=$( cat /tmp/sentry-envelope-12345123451234512345123451234512)
27- test " $ENVELOPE_CONTENTS " == " $( cat _unit-test/snapshots/sentry-envelope-12345123451234512345123451234512) "
34+ expected_filename=' sentry-envelope-f73e4da437c42a1d28b86a81ebcff35d'
35+ test " $SEND_EVENT_RESPONSE " == " Test Sending $expected_filename "
36+ ENVELOPE_CONTENTS=$( cat " /tmp/$expected_filename " )
37+ test " $ENVELOPE_CONTENTS " == " $( cat _unit-test/snapshots/$expected_filename ) "
2838echo " Pass."
2939
40+ # #########################
41+
3042echo " Testing send_event duplicate"
31- SEND_EVENT_RESPONSE=$( send_event " 12345123451234512345123451234512" " Test exited with status 1" " {\" ignore\" : \" me\" }" " $breadcrumbs " )
43+ SEND_EVENT_RESPONSE=$(
44+ send_event \
45+ " 'foo' exited with status 1" \
46+ " Test exited with status 1" \
47+ " Traceback: ignore me" \
48+ " {\" ignore\" : \" me\" }" \
49+ " $breadcrumbs "
50+ )
3251test " $SEND_EVENT_RESPONSE " == " Looks like you've already sent this error to us, we're on it :)"
3352echo " Pass."
34- rm ' /tmp/sentry-envelope-12345123451234512345123451234512'
53+ rm " /tmp/$expected_filename "
54+
55+ # #########################
3556
3657echo " Testing cleanup without minimizing downtime"
3758export REPORT_SELF_HOSTED_ISSUES=0
3859export MINIMIZE_DOWNTIME=' '
3960export dc=' :'
4061echo " Test Logs" > " $log_file "
41- CLEANUP_RESPONSE=$( cleanup ERROR)
62+ CLEANUP_RESPONSE=$( cleanup ERROR) # the linenumber of this line must match just below
4263rm " $log_file "
43- test " $CLEANUP_RESPONSE " == ' Error in _unit-test/error-handling-test.sh:41 .
64+ test " $CLEANUP_RESPONSE " == ' Error in _unit-test/error-handling-test.sh:62 .
4465' \' ' local cmd="${BASH_COMMAND}"' \' ' exited with status 0
4566
4667Cleaning up...'
4768echo " Pass."
4869
70+ # #########################
71+
4972echo " Testing cleanup while minimizing downtime"
5073export REPORT_SELF_HOSTED_ISSUES=0
5174export MINIMIZE_DOWNTIME=1
5275echo " Test Logs" > " $log_file "
53- CLEANUP_RESPONSE=$( cleanup ERROR)
76+ CLEANUP_RESPONSE=$( cleanup ERROR) # the linenumber of this line must match just below
5477rm " $log_file "
55- test " $CLEANUP_RESPONSE " == ' Error in _unit-test/error-handling-test.sh:53 .
78+ test " $CLEANUP_RESPONSE " == ' Error in _unit-test/error-handling-test.sh:76 .
5679' \' ' local cmd="${BASH_COMMAND}"' \' ' exited with status 0
5780
5881*NOT* cleaning up, to clean your environment run "docker compose stop".'
5982echo " Pass."
6083
84+ # #########################
85+
6186report_success
0 commit comments