Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
fix(test): Replace tag and hash for find transactions related apis
Browse files Browse the repository at this point in the history
When ENABLE_STAT is enabled, every api will be tested for TEST_COUNT times.
send_transfer will issue TEST_COUNT transactions with tag defined in
test_define.h which find transaction related apis also use to get
transaction info.

But after a few more times of execution, the size of retrieved transactions
will get larger than the valid storage of redis cache server, then driver
test would crash.

This fix defines FIND_TAG_MSG and TRYTES_81_3 for retriving and another
TAG_MSG for send_transfer that we can confirm the retrieved transaction info
would not get larger.
  • Loading branch information
jkrvivian committed Mar 26, 2019
1 parent 8441c1b commit 00d4f18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void test_get_transaction_object(void) {
clock_gettime(CLOCK_REALTIME, &start_time);
for (size_t count = 0; count < TEST_COUNT; count++) {
clock_gettime(CLOCK_REALTIME, &start_time);
TEST_ASSERT_FALSE(api_get_transaction_object(&ta_core.service, TRYTES_81_1,
TEST_ASSERT_FALSE(api_get_transaction_object(&ta_core.service, TRYTES_81_3,
&json_result));
clock_gettime(CLOCK_REALTIME, &end_time);
free(json_result);
Expand All @@ -124,8 +124,8 @@ void test_find_transactions_by_tag(void) {

for (size_t count = 0; count < TEST_COUNT; count++) {
clock_gettime(CLOCK_REALTIME, &start_time);
TEST_ASSERT_FALSE(
api_find_transactions_by_tag(&ta_core.service, TAG_MSG, &json_result));
TEST_ASSERT_FALSE(api_find_transactions_by_tag(&ta_core.service,
FIND_TAG_MSG, &json_result));
clock_gettime(CLOCK_REALTIME, &end_time);
free(json_result);
#if defined(ENABLE_STAT)
Expand All @@ -142,8 +142,8 @@ void test_find_transactions_obj_by_tag(void) {

for (size_t count = 0; count < TEST_COUNT; count++) {
clock_gettime(CLOCK_REALTIME, &start_time);
TEST_ASSERT_FALSE(api_find_transactions_obj_by_tag(&ta_core.service,
TAG_MSG, &json_result));
TEST_ASSERT_FALSE(api_find_transactions_obj_by_tag(
&ta_core.service, FIND_TAG_MSG, &json_result));
clock_gettime(CLOCK_REALTIME, &end_time);
free(json_result);
#if defined(ENABLE_STAT)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ extern "C" {
#define TRYTES_81_2 \
"RVORZ9SIIP9RCYMREUIXXVPQIPHVCNPQ9HZWYKFWYWZRE9JQKG9REPKIASHUUECPSQO9JT9XNM" \
"VKWYGVA"
#define TRYTES_81_3 \
"FPPBU9AOXZHSJEWDCPWGCPKGOVIUWWPDTIIXDJUKYYNNPTWCGDWFBZLKVCLOKGYEHJUMABSTA9" \
"OP99999"
#define BUNDLE_HASH \
"LVXEVZABVCIFEDSCONKEVEYBSIRMXGHLJDKSKQHTKZC9ULEAPSLKOOWCCZJGWSIISDDSEVUQHV" \
"GPFOSIW"
#define TAG_MSG "TANGLEACCELERATOR9999999999"
#define FIND_TAG_MSG "TAFINDTXN999999999999999999"
#define TAG_MSG_LEN 27
#define VALUE 100
#define TIMESTAMP 1546436542
Expand Down

0 comments on commit 00d4f18

Please sign in to comment.