Skip to content

Commit 1eb854d

Browse files
author
usharma
committed
tests: internal: aws_compress: zstd test cases added
zstd basic test cases added for compression detection and decoding validation Signed-off-by: Ujjwal Sharma <[email protected]> Signed-off-by: usharma <[email protected]>
1 parent de74f79 commit 1eb854d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/internal/aws_compress.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
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+
5673
void test_b64_truncated_gzip()
5774
{
5875
struct 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+
73106
void test_b64_truncated_gzip_truncation()
74107
{
75108
struct flb_aws_test_case cases[] =
@@ -202,7 +235,9 @@ struct flb_aws_test_case cases[] =
202235

203236
TEST_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 */
235278
static void flb_aws_compress_general_test_cases(int test_type,
236279
struct flb_aws_test_case *cases,

0 commit comments

Comments
 (0)