void test_set_upload_timeout(void **state) { (void)state; (void)state; size_t DEFAULT_UPLOAD_TIMEOUT = 2 * 60; kaa_error_t error_code = ext_log_upload_strategy_change_strategy(strategy, KAA_LOG_UPLOAD_VOLUME_STRATEGY); ASSERT_EQUAL(error_code, KAA_ERR_NONE); error_code = ext_log_upload_strategy_set_upload_timeout(strategy, DEFAULT_UPLOAD_TIMEOUT); ASSERT_EQUAL(error_code, KAA_ERR_NONE); ASSERT_EQUAL(ext_log_upload_strategy_get_timeout(strategy), DEFAULT_UPLOAD_TIMEOUT); }
static kaa_error_t remember_request(kaa_log_collector_t *self, uint16_t bucket_id) { KAA_RETURN_IF_NIL(self, KAA_ERR_BADPARAM); timeout_info_t *info = (timeout_info_t *)KAA_MALLOC(sizeof(timeout_info_t)); KAA_RETURN_IF_NIL(info, KAA_ERR_NOMEM); info->log_bucket_id = bucket_id; info->timeout = KAA_TIME() + (kaa_time_t)ext_log_upload_strategy_get_timeout(self->log_upload_strategy_context); kaa_list_node_t *it = kaa_list_push_back(self->timeouts, info); if (!it) { KAA_FREE(info); return KAA_ERR_NOMEM; } return KAA_ERR_NONE; }
void test_set_upload_timeout(void) { KAA_TRACE_IN(logger); kaa_error_t error_code = KAA_ERR_NONE; size_t DEFAULT_UPLOAD_TIMEOUT = 2 * 60; error_code = ext_log_upload_strategy_change_strategy(strategy, KAA_LOG_UPLOAD_VOLUME_STRATEGY); ASSERT_EQUAL(error_code, KAA_ERR_NONE); error_code = ext_log_upload_strategy_set_upload_timeout(strategy, DEFAULT_UPLOAD_TIMEOUT); ASSERT_EQUAL(error_code, KAA_ERR_NONE); ASSERT_EQUAL(ext_log_upload_strategy_get_timeout(strategy), DEFAULT_UPLOAD_TIMEOUT); KAA_TRACE_OUT(logger); }
static kaa_error_t remember_request(kaa_log_collector_t *self, uint16_t bucket_id, uint16_t count) { // TODO(KAA-982): Use asserts if (!self) { return KAA_ERR_BADPARAM; } timeout_info_t *info = KAA_MALLOC(sizeof(*info)); if (!info) { return KAA_ERR_NOMEM; } info->log_bucket_id = bucket_id; info->deadline = KAA_TIME() + (kaa_time_t)ext_log_upload_strategy_get_timeout(self->log_upload_strategy_context); info->log_count = count; kaa_list_node_t *it = kaa_list_push_back(self->timeouts, info); if (!it) { KAA_FREE(info); return KAA_ERR_NOMEM; } return KAA_ERR_NONE; }