15 require_once(dirname(dirname(__FILE__)) .
'/common-container.php');
16 require_once(dirname(dirname(__FILE__)) .
'/common-db.php');
17 require_once(dirname(dirname(__FILE__)) .
'/fossdash-config.php');
28 public $sys_conf =
"";
37 $this->testDb =
new TestPgDb(
"fosslibtest");
38 $sys_conf = $this->testDb->getFossSysConf();
52 $this->assertEquals(
"0", $SysConf[
'FOSSDASHCONFIG'][
'FossdashEnableDisable']);
53 $this->assertEquals(
"* * * * *", $SysConf[
'FOSSDASHCONFIG'][
'FossDashScriptCronSchedule']);
62 if (!is_callable(
'pg_connect')) {
65 $this->testDb->fullDestruct();
74 foreach (array(
'http://localhost:8086/write?db=fossology_db'=>
true,
75 'http://influxdb:8086/write?db=fossology_db'=>
true,
76 'http://127.0.0.1:8086/write?db=fossology_db'=>
true,
77 'ssh://127.0.0.1:8086'=>
false,) as $url=>$correct) {
78 $this->assertEquals(
check_fossdash_url($url),$correct,$message=
"result for URL $url is false");
88 foreach (array(
'* * * * *'=>
true,
92 '* * * * * 23567'=>
false,
93 '1 1 1 1 1 1'=>
false) as $cron=>$correct) {
104 foreach (array(
'fossology_instance_1'=>
true,
105 'fossology-instance-1'=>
true,
108 'fossology instance 1'=>
false,
109 'instance1'=>
true) as $instance_name=>$correct) {
120 foreach (array(
'22'=>
true,
124 'one'=>
false) as $clening_interval=>$correct) {
125 $this->assertEquals(
check_fossdash_cleaning($clening_interval),$correct,$message=
"result for CRON $clening_interval is false");
135 foreach (array(
'sfksb ghs 124 () * * ?'=>
true,
136 'drop table sysconfig'=>
false,
137 'alter table sysconfig'=>
false,
138 'INSERT INTO sysconfig'=>
false) as $metric=>$correct) {
139 $this->assertEquals(
check_fossdash_config($metric),$correct,$message=
"result for metric $metric is false");
tearDownDb()
clean the env
test_check_cron_job_inteval()
check cron job inteval
test_check_fossdash_cleaning()
check fossdash cleaning days
test_check_fossology_instance_name()
check fossology instance name
setUpDb()
initialization with db
test_check_fossdash_url()
check fossdash url
testConfigInit()
test for ConfigInit() after ConfigInit() is executed, we can get some sysconfig information,...
test_check_fossdash_config()
check fossdash metric config
check_fossdash_url($url)
Check if the fossdash url is valid.
check_fossology_instance_name($instance_name)
Check if the fossology instance name is valid.
check_cron_job_inteval($cron_interval)
Check if the cron job schedule interval is valid.
check_fossdash_config($config_str)
Check if given config string does not contains any DB update or drop related commands.
FossdashConfigInit($sysconfdir, &$SysConf)
Initialize the fossdash configuration after bootstrap().
check_fossdash_cleaning($cleaning_days)
Check if cleaning_days is valid or not.