44#include <fluent-bit/flb_mem.h>
55#include <fluent-bit/flb_utils.h>
66#include <fluent-bit/flb_gzip.h>
7+ #include <fluent-bit/flb_zstd.h>
78
89#include <fluent-bit/aws/flb_aws_compress.h>
910#include "flb_tests_internal.h"
@@ -53,6 +54,22 @@ void test_compression_gzip()
5354 flb_aws_compress_test_cases (cases );
5455}
5556
57+ void test_compression_zstd ()
58+ {
59+ struct flb_aws_test_case cases [] =
60+ {
61+ {
62+ "zstd" ,
63+ "hello hello hello hello hello hello" ,
64+ "KLUv/SAjZQAAMGhlbGxvIAEAuUsR" ,
65+ 0
66+ },
67+ { 0 }
68+ };
69+
70+ flb_aws_compress_test_cases (cases );
71+ }
72+
5673void test_b64_truncated_gzip ()
5774{
5875struct flb_aws_test_case cases [] =
@@ -70,6 +87,22 @@ struct flb_aws_test_case cases[] =
7087 41 );
7188}
7289
90+ void test_b64_truncated_zstd ()
91+ {
92+ struct flb_aws_test_case cases [] =
93+ {
94+ {
95+ "zstd" ,
96+ "hello hello hello hello hello hello" ,
97+ "hello hello hello hello hello hello" ,
98+ 0 /* Expected ret */
99+ },
100+ { 0 }
101+ };
102+
103+ flb_aws_compress_truncate_b64_test_cases__zstd_decode (cases ,41 );
104+ }
105+
73106void test_b64_truncated_gzip_truncation ()
74107{
75108struct flb_aws_test_case cases [] =
@@ -202,7 +235,9 @@ struct flb_aws_test_case cases[] =
202235
203236TEST_LIST = {
204237 { "test_compression_gzip" , test_compression_gzip },
238+ { "test_compression_zstd" , test_compression_zstd },
205239 { "test_b64_truncated_gzip" , test_b64_truncated_gzip },
240+ { "test_b64_truncated_zstd" , test_b64_truncated_zstd },
206241 { "test_b64_truncated_gzip_truncation" , test_b64_truncated_gzip_truncation },
207242 { "test_b64_truncated_gzip_truncation_buffer_too_small" ,
208243 test_b64_truncated_gzip_truncation_buffer_too_small },
@@ -231,6 +266,14 @@ static void flb_aws_compress_truncate_b64_test_cases__gzip_decode(
231266 cases , max_out_len , & flb_gzip_uncompress );
232267}
233268
269+ static void flb_aws_compress_truncate_b64_test_cases__zstd_decode (
270+ struct flb_aws_test_case * cases ,
271+ size_t max_out_len )
272+ {
273+ flb_aws_compress_general_test_cases (FLB_AWS_COMPRESS_TEST_TYPE_B64_TRUNCATE ,
274+ cases , max_out_len , & flb_zstd_uncompress );
275+ }
276+
234277/* General test case loop flb_aws_compress */
235278static void flb_aws_compress_general_test_cases (int test_type ,
236279 struct flb_aws_test_case * cases ,
0 commit comments