summaryrefslogtreecommitdiffstats
path: root/fluent-bit/tests/internal/data/pack/mixed.py
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/tests/internal/data/pack/mixed.py')
-rw-r--r--fluent-bit/tests/internal/data/pack/mixed.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/fluent-bit/tests/internal/data/pack/mixed.py b/fluent-bit/tests/internal/data/pack/mixed.py
new file mode 100644
index 00000000..7ad0a614
--- /dev/null
+++ b/fluent-bit/tests/internal/data/pack/mixed.py
@@ -0,0 +1,31 @@
+# Fluent Bit / Pack mixed samples to JSON
+# =======================================
+# This script generate the JSON formatted strings for the mixed_ABC.txt samples.
+
+import os
+import json
+import msgpack
+
+def gen_json(f):
+ raw = open(f, 'r')
+ data = raw.read()
+ raw.close()
+
+ out_mp = f[:-4] + ".mp"
+ out_json = f[:-4] + ".json"
+
+ # Write messagepack
+ fmp = open(out_mp, 'w')
+ fmp.write(msgpack.packb(data))
+ fmp.close()
+
+ fjson = open(out_json, 'w')
+ fjson.write(json.dumps(data))
+ fjson.close()
+
+for fn in os.listdir('.'):
+ if not os.path.isfile(fn):
+ continue
+
+ if fn.startswith('mixed_') and fn.endswith('.txt'):
+ gen_json(fn)