Skip to content

Commit 4997abd

Browse files
cosmo0920edsiper
authored andcommitted
tests: integration: Add a test case for quarantine case of out_s3
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent d1abb54 commit 4997abd

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
service:
2+
flush: 1
3+
grace: 3
4+
log_level: info
5+
http_server: on
6+
http_port: ${FLUENT_BIT_HTTP_MONITORING_PORT}
7+
8+
pipeline:
9+
inputs:
10+
- name: dummy
11+
tag: out_s3_retry_exhausted
12+
dummy: '{"message":"retry exhausted default quarantine","source":"dummy"}'
13+
samples: 1
14+
15+
outputs:
16+
- name: s3
17+
match: out_s3_retry_exhausted
18+
bucket: test-bucket
19+
region: us-east-1
20+
endpoint: http://127.0.0.1:1
21+
use_put_object: true
22+
retry_limit: 1
23+
total_file_size: 1M
24+
upload_timeout: 1s
25+
s3_key_format: /payloads/$TAG/$UUID
26+
content_type: application/x-ndjson
27+
store_dir: /tmp/fluent-bit-test-suite-s3-retry-exhausted
28+
store_dir_limit_size: 20M

tests/integration/scenarios/out_s3/tests/test_out_s3_001.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import gzip
22
import json
33
import os
4+
import glob
5+
import time
6+
import shutil
47

58
import requests
69
import pytest
@@ -218,3 +221,23 @@ def test_out_s3_otlp_json_uploads_signal_payloads(signal_type, json_file, root_k
218221

219222
rendered = json.dumps(payload)
220223
assert expected_value in rendered
224+
225+
226+
def test_out_s3_default_retry_exhausted_action_quarantines_file():
227+
store_dir = "/tmp/fluent-bit-test-suite-s3-retry-exhausted"
228+
if os.path.exists(store_dir):
229+
shutil.rmtree(store_dir)
230+
os.makedirs(store_dir, exist_ok=True)
231+
232+
service = Service("out_s3_retry_exhausted_default_quarantine.yaml")
233+
service.start()
234+
timeout = time.time() + 10
235+
files = []
236+
while time.time() < timeout:
237+
files = [p for p in glob.glob(f"{store_dir}/**", recursive=True) if os.path.isfile(p)]
238+
if len(files) > 0:
239+
break
240+
time.sleep(0.2)
241+
service.stop()
242+
243+
assert len(files) > 0

0 commit comments

Comments
 (0)