forked from msysgit/git
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
t0212: test URL redacting in EVENT format
In the added tests cases, skip testing the `GIT_TRACE2_REDACT=0` case because we would need to exactly model the full JSON event stream like we did in the preceding basic tests and I do not think it is worth it. Furthermore, the Trace2 routines print the same content in normal, perf, or event format, and in t0210 and t0211 we already tested the basic functionality, so no need to repeat it here. In this test, we use the test-helper to unit test each of the event messages where URLs can appear and confirm that they are redacted in each event. Signed-off-by: Jeff Hostetler <[email protected]>
- Loading branch information
1 parent
e50160f
commit 9bfd00c
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,4 +323,44 @@ test_expect_success 'discard traces when there are too many files' ' | |
head -n2 trace_target_dir/git-trace2-discard | tail -n1 | grep \"event\":\"too_many_files\" | ||
' | ||
|
||
# In the following "...redact..." tests, skip testing the GIT_TRACE2_REDACT=0 | ||
# case because we would need to exactly model the full JSON event stream like | ||
# we did in the basic tests above and I do not think it is worth it. | ||
|
||
test_expect_success 'unsafe URLs are redacted by default in cmd_start events' ' | ||
test_when_finished \ | ||
"rm -r trace.event" && | ||
GIT_TRACE2_EVENT="$(pwd)/trace.event" \ | ||
test-tool trace2 300redact_start git clone https://user:[email protected]/ clone2 && | ||
! grep user:pwd trace.event | ||
' | ||
|
||
test_expect_success 'unsafe URLs are redacted by default in child_start events' ' | ||
test_when_finished \ | ||
"rm -r trace.event" && | ||
GIT_TRACE2_EVENT="$(pwd)/trace.event" \ | ||
test-tool trace2 301redact_child_start git clone https://user:[email protected]/ clone2 && | ||
! grep user:pwd trace.event | ||
' | ||
|
||
test_expect_success 'unsafe URLs are redacted by default in exec events' ' | ||
test_when_finished \ | ||
"rm -r trace.event" && | ||
GIT_TRACE2_EVENT="$(pwd)/trace.event" \ | ||
test-tool trace2 302redact_exec git clone https://user:[email protected]/ clone2 && | ||
! grep user:pwd trace.event | ||
' | ||
|
||
test_expect_success 'unsafe URLs are redacted by default in def_param events' ' | ||
test_when_finished \ | ||
"rm -r trace.event" && | ||
GIT_TRACE2_EVENT="$(pwd)/trace.event" \ | ||
test-tool trace2 303redact_def_param url https://user:[email protected]/ && | ||
! grep user:pwd trace.event | ||
' | ||
|
||
test_done |