MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_cronAbort

Function test_cronAbort

tests/unit/test_cron.c:259–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259static void test_cronAbort() {
260 // reset X = 1
261 // issue a task X += 2
262 // abort task
263 // validate X = 1
264
265 X = 1;
266 int Y = 2;
267 AddTaskData data = _AddTaskData_New(add_task, (void *)&Y);
268
269 // issue task X += 2
270 CronTaskHandle task_handle = Cron_AddTask(15, _AddTaskData_Execute, NULL,
271 &data);
272
273 // abort task
274 Cron_AbortTask(task_handle);
275
276 // If we get here within the 0-15+ms interval, the cron thread
277 // shouldn't have yet begun the task execution.
278 TEST_ASSERT(!_AddTaskData_HasStarted(data));
279
280 _AddTaskData_Free(data);
281
282 // task should have been aborted prior to its execution
283 // expecting X = 1
284 TEST_ASSERT(X == 1);
285}
286
287static void test_cronLateAbort() {
288 // reset X = 1

Callers

nothing calls this directly

Calls 5

_AddTaskData_NewFunction · 0.85
Cron_AddTaskFunction · 0.85
Cron_AbortTaskFunction · 0.85
_AddTaskData_HasStartedFunction · 0.85
_AddTaskData_FreeFunction · 0.85

Tested by

no test coverage detected