-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix matching logic for logs from namespace when lines = 0 #5660
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the most recently added |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
SRC=$(cd $(dirname "$0"); pwd) | ||
source "${SRC}/../include.sh" | ||
|
||
cd $file_path/log-namespace/ | ||
|
||
LOG_PATH_PREFIX="${SRC}/__log-namespace__" | ||
|
||
rm -rf "${LOG_PATH_PREFIX}" | ||
mkdir "${LOG_PATH_PREFIX}" | ||
|
||
$pm2 start echo.js --namespace e2e-test-log-namespace | ||
|
||
LOG_FILE_BASELINE="${LOG_PATH_PREFIX}/baseline-out.log" | ||
$pm2 logs e2e-test-log-namespace > $LOG_FILE_BASELINE & # backgrounded - will be stopped by `$pm2 delete all` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't seen any e2e (or programmatic tests) for the |
||
|
||
sleep 2 # should leave time for ~40 "tick" lines | ||
|
||
# Using -q to avoid spamming, since there will be a fair few "tick" matches | ||
grep -q "tick" ${LOG_FILE_BASELINE} | ||
spec "Should have 'tick' in the log file" | ||
|
||
LOG_FILE_LINES_ZERO="${LOG_PATH_PREFIX}/lines-zero-out.log" | ||
$pm2 logs e2e-test-log-namespace --lines 0 > $LOG_FILE_LINES_ZERO & | ||
|
||
sleep 2 # should leave time for ~40 "tick" lines | ||
|
||
# Using -q to avoid spamming, since there will be a fair few "tick" matches | ||
grep -q "tick" ${LOG_FILE_LINES_ZERO} | ||
spec "Should have 'tick' in the log file even if using --lines 0" | ||
|
||
cd ${SRC} | ||
rm -rf "${LOG_PATH_PREFIX}" | ||
$pm2 delete all |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
console.log("start"); | ||
setInterval(function () { | ||
console.log("tick"); | ||
}, 50); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separating out
isMatchingProcess
felt more readable to me - happy to revert back to something like this instead: