Skip to content

Commit aee12bc

Browse files
committed
[FLINK-26105][e2e] Fixes log file extension
Rolling log file naming strategy is enabled by default which might cause test instabilities do to the relevant substring not being present in the *.log file. This change expands the grep and find calls to also consider *.log.[0-9]+ files.
1 parent a8700dd commit aee12bc

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

flink-end-to-end-tests/test-scripts/common.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ function wait_for_job_state_transition {
488488
echo "Waiting for job ($job) to switch from state ${initial_state} to state ${next_state} ..."
489489

490490
while : ; do
491-
N=$(grep -o "($job) switched from state ${initial_state} to ${next_state}" $FLINK_LOG_DIR/*standalonesession*.log | tail -1)
491+
N=$(grep -o "($job) switched from state ${initial_state} to ${next_state}" $FLINK_LOG_DIR/*standalonesession*.log* | tail -1)
492492

493493
if [[ -z $N ]]; then
494494
sleep 1
@@ -523,7 +523,7 @@ function wait_job_terminal_state {
523523
echo "Waiting for job ($job) to reach terminal state $expected_terminal_state ..."
524524

525525
while : ; do
526-
local N=$(grep -o "Job $job reached terminal state .*" $FLINK_LOG_DIR/*$log_file_name*.log | tail -1 || true)
526+
local N=$(grep -o "Job $job reached terminal state .*" $FLINK_LOG_DIR/*$log_file_name*.log* | tail -1 || true)
527527
if [[ -z $N ]]; then
528528
sleep 1
529529
else
@@ -645,7 +645,7 @@ function get_job_metric {
645645
function get_metric_processed_records {
646646
OPERATOR=$1
647647
JOB_NAME="${2:-General purpose test job}"
648-
N=$(grep ".${JOB_NAME}.$OPERATOR.numRecordsIn:" $FLINK_LOG_DIR/*taskexecutor*.log | sed 's/.* //g' | tail -1)
648+
N=$(grep ".${JOB_NAME}.$OPERATOR.numRecordsIn:" $FLINK_LOG_DIR/*taskexecutor*.log* | sed 's/.* //g' | tail -1)
649649
if [ -z $N ]; then
650650
N=0
651651
fi
@@ -655,7 +655,7 @@ function get_metric_processed_records {
655655
function get_num_metric_samples {
656656
OPERATOR=$1
657657
JOB_NAME="${2:-General purpose test job}"
658-
N=$(grep ".${JOB_NAME}.$OPERATOR.numRecordsIn:" $FLINK_LOG_DIR/*taskexecutor*.log | wc -l)
658+
N=$(grep ".${JOB_NAME}.$OPERATOR.numRecordsIn:" $FLINK_LOG_DIR/*taskexecutor*.log* | wc -l)
659659
if [ -z $N ]; then
660660
N=0
661661
fi
@@ -705,7 +705,7 @@ function wait_num_of_occurence_in_logs {
705705
echo "Waiting for text ${text} to appear ${number} of times in logs..."
706706

707707
while : ; do
708-
N=$(grep -o "${text}" $FLINK_LOG_DIR/*${logs}*.log | wc -l)
708+
N=$(grep -o "${text}" $FLINK_LOG_DIR/*${logs}*.log* | wc -l)
709709

710710
if [ -z $N ]; then
711711
N=0
@@ -734,7 +734,7 @@ function wait_num_checkpoints {
734734
echo "Waiting for job ($JOB) to have at least $NUM_CHECKPOINTS completed checkpoints ..."
735735

736736
while : ; do
737-
N=$(grep -o "Completed checkpoint [1-9]* for job $JOB" $FLINK_LOG_DIR/*standalonesession*.log | awk '{print $3}' | tail -1)
737+
N=$(grep -o "Completed checkpoint [1-9]* for job $JOB" $FLINK_LOG_DIR/*standalonesession*.log* | awk '{print $3}' | tail -1)
738738

739739
if [ -z $N ]; then
740740
N=0
@@ -776,7 +776,7 @@ function expect_in_taskmanager_logs {
776776
local expected="$1"
777777
local timeout=$2
778778
local i=0
779-
local logfile="$FLINK_LOG_DIR/flink*taskexecutor*log"
779+
local logfile="$FLINK_LOG_DIR/flink*taskexecutor*log*"
780780

781781

782782
while ! grep "${expected}" ${logfile} > /dev/null; do

flink-end-to-end-tests/test-scripts/common_ha.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function verify_num_occurences_in_logs() {
4949
local text="$2"
5050
local expected_no="$3"
5151

52-
local actual_no=$(grep -r --include "*${log_pattern}*.log" -e "${text}" "$FLINK_LOG_DIR/" | cut -d ":" -f 1 | uniq | wc -l)
52+
local actual_no=$(grep -r --include "*${log_pattern}*.log*" -e "${text}" "$FLINK_LOG_DIR/" | cut -d ":" -f 1 | sed "s/\.[0-9]\{1,\}$//g" | uniq | wc -l)
5353
[[ "${expected_no}" -eq "${actual_no}" ]]
5454
}
5555

flink-end-to-end-tests/test-scripts/queryable_state_base.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function link_queryable_state_lib {
2525

2626
# Returns the ip address of the queryable state server
2727
function get_queryable_state_server_ip {
28-
local ip=$(cat $FLINK_LOG_DIR/flink*taskexecutor*log \
28+
local ip=$(cat $FLINK_LOG_DIR/flink*taskexecutor*log* \
2929
| grep "Started Queryable State Server" \
3030
| head -1 \
3131
| grep -Eo "\.*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.*")
@@ -35,7 +35,7 @@ function get_queryable_state_server_ip {
3535

3636
# Returns the ip address of the queryable state server
3737
function get_queryable_state_proxy_port {
38-
local port=$(cat $FLINK_LOG_DIR/flink*taskexecutor*log \
38+
local port=$(cat $FLINK_LOG_DIR/flink*taskexecutor*log* \
3939
| grep "Started Queryable State Proxy Server" \
4040
| head -1 \
4141
| grep -Eo "\.*\:([0-9]{3,5})\.*" | tr -d ":.")

flink-end-to-end-tests/test-scripts/test_cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function extract_valid_job_list_by_type_from_job_list_return() {
6565
}
6666

6767
function extract_task_manager_slot_request_count() {
68-
COUNT=`grep "Receive slot request" $FLINK_LOG_DIR/*taskexecutor*.log | wc -l`
68+
COUNT=`grep "Receive slot request" $FLINK_LOG_DIR/*taskexecutor*.log* | wc -l`
6969
echo $COUNT
7070
}
7171

flink-end-to-end-tests/test-scripts/test_rocksdb_state_memory_control.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function buildBaseJobCmd {
8080
function find_max_block_cache_usage() {
8181
OPERATOR=$1
8282
JOB_NAME="${2:-General purpose test job}"
83-
N=$(grep ".${JOB_NAME}.$OPERATOR.rocksdb.block-cache-usage:" $FLINK_LOG_DIR/*taskexecutor*.log | sed 's/.* //g' | sort -rn | head -n 1)
83+
N=$(grep ".${JOB_NAME}.$OPERATOR.rocksdb.block-cache-usage:" $FLINK_LOG_DIR/*taskexecutor*.log* | sed 's/.* //g' | sort -rn | head -n 1)
8484
if [ -z $N ]; then
8585
N=0
8686
fi

tools/ci/controller_utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ print_system_info() {
3333

3434
# locate YARN logs and put them into artifacts directory
3535
put_yarn_logs_to_artifacts() {
36-
for file in `find ./flink-yarn-tests/target -type f -name '*.log' -or -name '*.out'`; do
36+
for file in `find ./flink-yarn-tests/target -type f -name '*.log*' -or -name '*.out'`; do
3737
TARGET_FILE=`echo "$file" | grep -Eo "container_[0-9_]+/(.*).[a-z]{3}"`
3838
TARGET_DIR=`dirname "$TARGET_FILE"`
3939
mkdir -p "$DEBUG_FILES_OUTPUT_DIR/yarn-tests/$TARGET_DIR"

tools/ci/maven-utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function collect_coredumps {
7474
local SEARCHDIR=$1
7575
local TARGET_DIR=$2
7676
echo "Searching for .dump, .dumpstream and related files in '$SEARCHDIR'"
77-
for file in `find $SEARCHDIR -type f -regextype posix-extended -iregex '.*\.hprof|.*\.dump|.*\.dumpstream|.*hs.*\.log|.*/core(.[0-9]+)?$'`; do
77+
for file in `find $SEARCHDIR -type f -regextype posix-extended -iregex '.*\.hprof|.*\.dump|.*\.dumpstream|.*hs.*\.log(\.[0-9]+)?|.*/core(\.[0-9]+)?$'`; do
7878
echo "Moving '$file' to target directory ('$TARGET_DIR')"
7979
mv $file $TARGET_DIR/$(echo $file | tr "/" "-")
8080
done

0 commit comments

Comments
 (0)