Skip to content

Commit d31bc0b

Browse files
cosmo0920edsiper
authored andcommitted
tests: runtime: Try to eliminate flakyness on CI load
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 8bb42bb commit d31bc0b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

tests/runtime/out_lib.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ static void test_max_records(void)
445445
int num;
446446
char *input_json = "[1,{\"hoge\":\"moge\", \"bool\":true, \"int\":100, \"float\":-2.0}]";
447447
int size = strlen(input_json);
448+
char *input_buffer;
449+
int input_records = 100;
450+
int input_size;
448451
int i;
449452
int unused;
450453
int expected = 5 /* max_records */;
@@ -473,9 +476,18 @@ static void test_max_records(void)
473476
ret = flb_start(ctx->flb);
474477
TEST_CHECK(ret == 0);
475478

476-
for (i=0; i<100; i++) {
477-
ret = flb_lib_push(ctx->flb, ctx->i_ffd, input_json,size);
479+
input_size = size * input_records;
480+
input_buffer = flb_malloc(input_size);
481+
TEST_CHECK(input_buffer != NULL);
482+
483+
if (input_buffer != NULL) {
484+
for (i = 0; i < input_records; i++) {
485+
memcpy(input_buffer + (i * size), input_json, size);
486+
}
487+
488+
ret = flb_lib_push(ctx->flb, ctx->i_ffd, input_buffer, input_size);
478489
TEST_CHECK(ret >= 0);
490+
flb_free(input_buffer);
479491
}
480492

481493
/* waiting to flush */

0 commit comments

Comments
 (0)