FOSSology  4.4.0
Open Source License Compliance by Open Source Software
testJob.c File Reference

Unit test for job operations. More...

#include <testRun.h>
#include <scheduler.h>
#include <job.h>
#include <utils.h>
Include dependency graph for testJob.c:

Go to the source code of this file.

Functions

int Prepare_Testing_Data_Job (scheduler_t *scheduler)
 
void test_job_event ()
 Test for job events. More...
 
void test_job_fun ()
 Test for job functions. More...
 

Variables

CU_TestInfo tests_job []
 

Detailed Description

Unit test for job operations.

Definition in file testJob.c.

Function Documentation

◆ Prepare_Testing_Data_Job()

int Prepare_Testing_Data_Job ( scheduler_t scheduler)

Local function for testing data prepare

Definition at line 23 of file testJob.c.

◆ test_job_event()

void test_job_event ( )

Test for job events.

Test:
  1. Initialize scheduler and database
  2. Create new database_update_event() to load data
  3. Get the job from scheduler and call
    1. job_verbose_event() and check if job is updated
    2. job_pause_event() and check if job is paused
    3. job_restart_event() and check if job is restarted
    4. job_priority_event() and check if job is restarted
    5. job_fail_event() and check if job is failed

Definition at line 43 of file testJob.c.

◆ test_job_fun()

void test_job_fun ( )

Test for job functions.

Test:
  1. Initialize scheduler and database
  2. Create new database_update_event() to load data
  3. Get the job from scheduler and call
    1. job_next() and check the job queue id
    2. next_job() and check the job is NOT NULL and its id is 1
    3. peek_job() and check the job is NOT NULL and its id is 1
    4. active_jobs() and check the result is 0

Definition at line 102 of file testJob.c.

Variable Documentation

◆ tests_job

CU_TestInfo tests_job[]
Initial value:
=
{
{"Test job_event", test_job_event },
{"Test job_fun", test_job_fun },
CU_TEST_INFO_NULL
}
void test_job_fun()
Test for job functions.
Definition: testJob.c:102
void test_job_event()
Test for job events.
Definition: testJob.c:43

Definition at line 140 of file testJob.c.