[Buildroot] [PATCH v2 3/3] support/testing/tests/package/test_fluent_bit.py: new runtime test
Thomas Devoogdt
thomas at devoogdt.com
Sun Mar 8 08:12:12 UTC 2026
Signed-off-by: Thomas Devoogdt <thomas at devoogdt.com>
---
v2: no change
---
DEVELOPERS | 1 +
.../testing/tests/package/test_fluent_bit.py | 46 +++++++++++++++++++
2 files changed, 47 insertions(+)
create mode 100644 support/testing/tests/package/test_fluent_bit.py
diff --git a/DEVELOPERS b/DEVELOPERS
index f7c5b077067..dcd25eba388 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3197,6 +3197,7 @@ F: package/fluent-bit/
F: package/librdkafka/
F: package/libsoup3/
F: package/yq/
+F: support/testing/tests/package/test_fluent_bit.py
N: Thomas Huth <th.huth+br at posteo.eu>
F: package/ascii-invaders/
diff --git a/support/testing/tests/package/test_fluent_bit.py b/support/testing/tests/package/test_fluent_bit.py
new file mode 100644
index 00000000000..825e4ec6d2d
--- /dev/null
+++ b/support/testing/tests/package/test_fluent_bit.py
@@ -0,0 +1,46 @@
+import os
+import json
+import time
+
+import infra.basetest
+
+
+class TestFluentBit(infra.basetest.BRTest):
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+ """
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ BR2_PACKAGE_FLUENT_BIT=y
+ """
+
+ def test_run(self):
+ cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+ self.emulator.boot(arch="armv5",
+ kernel="builtin",
+ options=["-initrd", cpio_file])
+ self.emulator.login()
+
+ # Enable the http server
+ cmd = ("sed -i 's/http_server Off/http_server On/g' "
+ "/etc/fluent-bit/fluent-bit.conf && "
+ "/etc/init.d/S99fluent-bit restart")
+ _, exit_code = self.emulator.run(cmd)
+ self.assertEqual(exit_code, 0)
+
+ # Give some runtime
+ time.sleep(5)
+
+ # Check the uptime
+ cmd = "wget -qO- http://127.0.0.1:2020/api/v1/uptime"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEqual(exit_code, 0)
+ uptime = json.loads(output[0])
+ self.assertGreater(uptime["uptime_sec"], 3)
+
+ # Check the metrics
+ cmd = "wget -qO- http://127.0.0.1:2020/api/v1/metrics"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEqual(exit_code, 0)
+ metrics = json.loads(output[0])
+ self.assertGreater(metrics["input"]["cpu.0"]["records"], 0)
+ self.assertGreater(metrics["output"]["stdout.0"]["proc_records"], 0)
--
2.43.0
More information about the buildroot
mailing list