summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-10-15 04:48:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-15 04:48:01 (GMT)
commitd0ce4d9024882b5363141288979ea3689eab9998 (patch)
treecfd58c1a5cb0f735536ca96400329649477e8d7f /t
parent6ed610b96840349e9a29c40e60dc926ce03d982b (diff)
parent87db61a4363ad9f42cf7b0d90ad13763dc01e3af (diff)
downloadgit-d0ce4d9024882b5363141288979ea3689eab9998.zip
git-d0ce4d9024882b5363141288979ea3689eab9998.tar.gz
git-d0ce4d9024882b5363141288979ea3689eab9998.tar.bz2
Merge branch 'js/trace2-cap-max-output-files'
The trace2 output, when sending them to files in a designated directory, can populate the directory with too many files; a mechanism is introduced to set the maximum number of files and discard further logs when the maximum is reached. * js/trace2-cap-max-output-files: trace2: write discard message to sentinel files trace2: discard new traces if target directory has too many files docs: clarify trace2 version invariants docs: mention trace2 target-dir mode in git-config
Diffstat (limited to 't')
-rwxr-xr-xt/t0212-trace2-event.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t0212-trace2-event.sh b/t/t0212-trace2-event.sh
index ff5b9cc..7065a1b 100755
--- a/t/t0212-trace2-event.sh
+++ b/t/t0212-trace2-event.sh
@@ -265,4 +265,23 @@ test_expect_success JSON_PP 'using global config, event stream, error event' '
test_cmp expect actual
'
+test_expect_success 'discard traces when there are too many files' '
+ mkdir trace_target_dir &&
+ test_when_finished "rm -r trace_target_dir" &&
+ (
+ GIT_TRACE2_MAX_FILES=5 &&
+ export GIT_TRACE2_MAX_FILES &&
+ cd trace_target_dir &&
+ test_seq $GIT_TRACE2_MAX_FILES >../expected_filenames.txt &&
+ xargs touch <../expected_filenames.txt &&
+ cd .. &&
+ GIT_TRACE2_EVENT="$(pwd)/trace_target_dir" test-tool trace2 001return 0
+ ) &&
+ echo git-trace2-discard >>expected_filenames.txt &&
+ ls trace_target_dir >ls_output.txt &&
+ test_cmp expected_filenames.txt ls_output.txt &&
+ head -n1 trace_target_dir/git-trace2-discard | grep \"event\":\"version\" &&
+ head -n2 trace_target_dir/git-trace2-discard | tail -n1 | grep \"event\":\"too_many_files\"
+'
+
test_done