Skip to content

Commit 8cbea96

Browse files
Merge pull request openshift#1555 from richm/fix-merge-json-log-test
guard against MERGE_JSON_LOG test flakes
2 parents da42a18 + c9f10fb commit 8cbea96

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

fluentd/configs.d/openshift/filter-viaq-data-model.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<filter **>
22
@type viaq_data_model
3-
default_keep_fields CEE,@timestamp,aushape,ci_job,collectd,docker,fedora-ci,file,foreman,geoip,hostname,ipaddr4,ipaddr6,kubernetes,level,message,namespace_name,namespace_uuid,offset,openstack,ovirt,pid,pipeline_metadata,rsyslog,service,systemd,tags,testcase,tlog,viaq_msg_id
3+
default_keep_fields CEE,time,@timestamp,aushape,ci_job,collectd,docker,fedora-ci,file,foreman,geoip,hostname,ipaddr4,ipaddr6,kubernetes,level,message,namespace_name,namespace_uuid,offset,openstack,ovirt,pid,pipeline_metadata,rsyslog,service,systemd,tags,testcase,tlog,viaq_msg_id
44
extra_keep_fields "#{ENV['CDM_EXTRA_KEEP_FIELDS'] || ''}"
55
keep_empty_fields "#{ENV['CDM_KEEP_EMPTY_FIELDS'] || 'message'}"
66
use_undefined "#{ENV['CDM_USE_UNDEFINED'] || false}"

test/json-parsing.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ cleanup() {
2727
if [ -n "${fpod:-}" ] ; then
2828
get_fluentd_pod_log > $ARTIFACT_DIR/json-parsing-fluentd-pod.log
2929
fi
30-
# disable merge json log
31-
stop_fluentd
32-
oc set env $fluentd_ds MERGE_JSON_LOG=false
33-
start_fluentd
30+
if [ "${orig_MERGE_JSON_LOG:-}" = unset ] ; then
31+
orig_MERGE_JSON_LOG="MERGE_JSON_LOG-"
32+
fi
33+
if [ "${orig_CDM_UNDEFINED_TO_STRING:-}" = unset ] ; then
34+
orig_CDM_UNDEFINED_TO_STRING="CDM_UNDEFINED_TO_STRING-"
35+
fi
36+
if [ -n "${orig_MERGE_JSON_LOG:-}" -o -n "${orig_CDM_UNDEFINED_TO_STRING:-}" ] ; then
37+
stop_fluentd
38+
oc set env $fluentd_ds ${orig_MERGE_JSON_LOG:-} ${orig_CDM_UNDEFINED_TO_STRING:-}
39+
start_fluentd
40+
fi
3441
# this will call declare_test_end, suite_end, etc.
3542
os::test::junit::reconcile_output
3643
exit $return_code
@@ -40,6 +47,14 @@ trap "cleanup" EXIT
4047
os::log::info Starting json-parsing test at $( date )
4148

4249
# enable merge json log
50+
orig_MERGE_JSON_LOG=$( oc set env $fluentd_ds --list | grep \^MERGE_JSON_LOG= ) || :
51+
if [ -z "$orig_MERGE_JSON_LOG" ] ; then
52+
orig_MERGE_JSON_LOG=unset
53+
fi
54+
orig_CDM_UNDEFINED_TO_STRING=$( oc set env $fluentd_ds --list | grep \^CDM_UNDEFINED_TO_STRING= ) || :
55+
if [ -z "$orig_CDM_UNDEFINED_TO_STRING" ] ; then
56+
orig_CDM_UNDEFINED_TO_STRING=unset
57+
fi
4358
stop_fluentd
4459
oc set env $fluentd_ds MERGE_JSON_LOG=true CDM_UNDEFINED_TO_STRING=false
4560
start_fluentd

0 commit comments

Comments
 (0)