Skip to content

Commit 2254190

Browse files
jeffhostetlergitster
authored andcommitted
structured-logging: t0420 tests for interacitve child_summary
Test running a command with a fake pager and verify that a child_summary is generated. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 78b93cc commit 2254190

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

t/t0420-structured-logging.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,34 @@ test_expect_success PERLJSON 'verify child start/end events during clone' '
260260
grep "row\[1\]\.detail\.data\.child_exit_code 0" <parsed_detail
261261
'
262262

263+
. "$TEST_DIRECTORY"/lib-pager.sh
264+
. "$TEST_DIRECTORY"/lib-terminal.sh
265+
266+
test_expect_success 'setup fake pager to test interactive' '
267+
test_when_finished "rm \"$LOGFILE\" " &&
268+
sane_unset GIT_PAGER GIT_PAGER_IN_USE &&
269+
test_unconfig core.pager &&
270+
271+
PAGER="cat >paginated.out" &&
272+
export PAGER &&
273+
274+
test_commit initial
275+
'
276+
277+
test_expect_success TTY 'verify fake pager detected and process marked interactive' '
278+
test_when_finished "rm \"$LOGFILE\" event_exit" &&
279+
rm -f paginated.out &&
280+
rm -f "$LOGFILE" &&
281+
282+
test_terminal git log &&
283+
test -e paginated.out &&
284+
285+
grep -f key_cmd_exit "$LOGFILE" >event_exit &&
286+
287+
perl "$TEST_DIRECTORY"/t0420/parse_json.perl <event_exit >parsed_exit &&
288+
289+
grep "row\[0\]\.child_summary\.pager\.count 1" <parsed_exit
290+
'
291+
292+
263293
test_done

0 commit comments

Comments
 (0)