Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken test #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests_*
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ build: deb/td-agent-bit_${FLUENTBIT_VERSION}_amd64.deb
down:

tests:
@echo "no functionnal tests"
docker-compose -f tests_fluentbit/docker-compose.yml up -d fluentd
docker-compose -f tests_fluentbit/docker-compose.yml run test
docker-compose -f tests_fluentbit/docker-compose.yml logs fluentd
10 changes: 7 additions & 3 deletions td-agent-bit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
# - trace
#
# By default 'info' is set, that means it includes 'error' and 'warning'.
Log_Level info
Log_Level trace

Log_File /proc/1/fd/1

# Parsers_File
# ============
Expand All @@ -30,7 +32,9 @@
[INPUT]
Name Forward
Port 24224
Bind 0.0.0.0

[OUTPUT]
Name stdout
Match *
Name file
Path /proc/1/fd/1
Match app.*
6 changes: 6 additions & 0 deletions tests_fluentbit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/tmp/venv:
python3 -m venv /tmp/venv
/tmp/venv/bin/pip install fluent-logger

tests: /tmp/venv
/tmp/venv/bin/python tests.py
18 changes: 18 additions & 0 deletions tests_fluentbit/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---

version: "3"

services:
fluentd:
image: bearstech/fluentbit:latest
volumes:
- ../:/tests_fluentbit

test:
image: bearstech/python-dev:3
working_dir: /tests_fluentbit
volumes:
- ../:/tests_fluentbit
command: make -C tests_fluentbit tests
depends_on:
- fluentd
12 changes: 12 additions & 0 deletions tests_fluentbit/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from fluent import sender


logger = sender.FluentSender("app", host="fluentd", port=24224)
print("Sender:", logger)

res = logger.emit("test", {"from": "userA", "to": "userB"})
print("Result:", res)
if not res:
raise RuntimeError(logger.last_error)

logger.close()