mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Added an automatic test: stressing import.php
SVN:trunk[823]
This commit is contained in:
@@ -252,7 +252,15 @@ abstract class TestWebServices extends TestHandler
|
||||
$fp = @fopen($sUrl, 'rb', false, $ctx);
|
||||
if (!$fp)
|
||||
{
|
||||
throw new Exception("Problem with $sUrl, $php_errormsg");
|
||||
global $php_errormsg;
|
||||
if (isset($php_errormsg))
|
||||
{
|
||||
throw new Exception("Problem with $sUrl, $php_errormsg");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Problem with $sUrl");
|
||||
}
|
||||
}
|
||||
$response = @stream_get_contents($fp);
|
||||
if ($response === false)
|
||||
|
||||
@@ -1206,7 +1206,7 @@ class TestImportREST extends TestWebServices
|
||||
|
||||
static public function GetDescription()
|
||||
{
|
||||
return 'Bulk load in the background';
|
||||
return 'Test various options and fonctionality of import.php';
|
||||
}
|
||||
|
||||
protected function DoExecSingleLoad($aLoadSpec)
|
||||
@@ -1230,12 +1230,21 @@ class TestImportREST extends TestWebServices
|
||||
|
||||
$sArguments = implode('<br/>', $aGetParamReport);
|
||||
|
||||
if (strlen($sCsvData) > 5000)
|
||||
{
|
||||
$sCsvDataViewable = 'INPUT TOO LONG TO BE DISPLAYED ('.strlen($sCsvData).")\n".substr($sCsvData, 0, 500)."\n... TO BE CONTINUED";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sCsvDataViewable = $sCsvData;
|
||||
}
|
||||
|
||||
echo "<div style=\"\">\n";
|
||||
echo " <div style=\"float: left; padding: 5; background-color: #eeeeff;\">\n";
|
||||
echo " <div style=\"float:left; width:45%; padding:5; background-color:#eeeeff;\">\n";
|
||||
echo " $sArguments\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style=\"float: right; padding: 5; background-color: #eeeeff\">\n";
|
||||
echo " <pre class=\"vardump\">$sCsvData</pre>\n";
|
||||
echo " <div style=\"float:right; width:45%; padding:5; background-color:#eeeeff\">\n";
|
||||
echo " <pre class=\"vardump\">$sCsvDataViewable</pre>\n";
|
||||
echo " </div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
@@ -1495,6 +1504,45 @@ class TestImportREST extends TestWebServices
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Test massive data load
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestImportRESTMassive extends TestImportREST
|
||||
{
|
||||
static public function GetName()
|
||||
{
|
||||
return 'CSV import (REST) - HUGE data set (20000 PCs)';
|
||||
}
|
||||
|
||||
static public function GetDescription()
|
||||
{
|
||||
return 'Stress import.php';
|
||||
}
|
||||
|
||||
protected function DoExecute()
|
||||
{
|
||||
$aLoadSpec = array(
|
||||
'desc' => 'Missing class',
|
||||
'args' => array(
|
||||
'class' => 'PC',
|
||||
'output' => 'summary',
|
||||
),
|
||||
'csvdata' => "name;org_id;brand\n",
|
||||
);
|
||||
$iMaxPC = 20000;
|
||||
for($i = 0 ; $i <= $iMaxPC ; $i++)
|
||||
{
|
||||
$aLoadSpec['csvdata'] .= "pc.import.$i;2;Combodo\n";
|
||||
}
|
||||
$this->DoExecSingleLoad($aLoadSpec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Test SOAP services
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$aWebServices = array(
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user