func tests: "I! Starting Telegraf" isn't reliable to detect the last restart in logs

Bug #1919336 reported by Laurent Sesquès
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Telegraf Charm
Fix Released
Undecided
Unassigned

Bug Description

In the compute functional tests, we rely on "I! Starting Telegraf" to discard logs priori to the last restart.
But Telegraf doesn't always log it. I found that the only reliable log line was "I! Loaded inputs:".
We should determine if this is a bug in telegraf itself (in which case, we'll file a bug upstream), or if it's intended in which case we should:

--- a/src/tests/functional/tests/test_compute.py
+++ b/src/tests/functional/tests/test_compute.py
@@ -42,7 +42,7 @@ class TestTelegrafCompute(BaseTelegrafTest):
         )
         # Sometimes, the logs show errors on Telegraf first start because br-int isn't
         # yet started. To overcome this, just check the most recent start of Telegraf.
- up_to_word = "I! Starting Telegraf"
+ up_to_word = "I! Loaded inputs:"
         rx_to_last = r"^.*{}".format(re.escape(up_to_word))
         last_logs = re.sub(rx_to_last, "", content, flags=re.DOTALL).strip()
         error_pattern = "E!"

Revision history for this message
Laurent Sesquès (sajoupa) wrote :

The root cause is (imho) a but in telegraf upstream, so I filed:
https://github.com/influxdata/telegraf/issues/9120

Until a fix is released, we should handle this case in the test suite though.

Revision history for this message
Eric Chen (eric-chen) wrote :

Upstream solved.

Changed in charm-telegraf:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.