23 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
24 include_once(__DIR__.
'/SchedulerTestRunner.php');
35 public function __construct(
TestPgDb $testDb)
37 $this->testDb = $testDb;
44 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
46 $sysConf = $this->testDb->getFossSysConf();
48 $agentName =
"decider";
50 $agentDir = dirname(dirname(__DIR__));
51 $execDir =
"$agentDir/agent";
52 system(
"install -D $agentDir/VERSION $sysConf/mods-enabled/$agentName/VERSION");
54 $pipeFd = popen($cmd =
"echo $uploadId | $execDir/$agentName --userID=$userId --groupID=$groupId --jobId=$jobId --scheduler_start -c $sysConf $args",
"r");
55 $success = $pipeFd !==
false;
60 while (($buffer = fgets($pipeFd, 4096)) !==
false) {
63 $retCode = pclose($pipeFd);
65 print
"failed opening pipe to $cmd";
68 unlink(
"$sysConf/mods-enabled/$agentName/VERSION");
69 rmdir(
"$sysConf/mods-enabled/$agentName");
70 rmdir(
"$sysConf/mods-enabled");
72 return array($success, $output, $retCode);
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Get the arguments required by agent to run and try to run the agent.
Create dummy run interface.