Привет всем.
Поставил soapuipro 5.1.1.И создал скрипт для выполнения проверок.В забиксе сделал внешнюю проверку. Из командной строки linux скрипт отрабатывает и создаёт нужные отчёты и проверки. Из под Забикса творится чертовщина, а именно эта ошибка
Missing SoapUI project file.. ErrorOfRunProject
Если меняю оболочку на
#!/bin/bash
то вылетает такое
ShinaTest.sh: line 47: $pathReportsDirectoryForHost/"$2RunLogs.txt": ambiguous redirect ErrorOfRunProject
в Забиксе запускается скрипт так
ShinaTest.sh["{HOSTNAME}"]
my script
#!/bin/sh
pathSoapUIDirectory=/opt/SoapUI-Pro-5.1.1/bin/
pathZabbixDirectory=/usr/lib/zabbix/externalscripts
pathSoapUiProjectWithName=$pathZabbixDirectory/"Shina-soapui-project.xml"
pathParentReportDir=/tmp/SoapReport
pathReportsDirectory=$pathParentReportDir/"Shina-soapui-project"
pathReportsDirectoryForHost=$pathReportsDirectory/"$1"
if [ -d "$pathParentReportDir" ];
then
chmod 777 "$pathParentReportDir"
else
mkdir "$pathParentReportDir"
chmod 777 "$pathParentReportDir"
fi
if [ -d "$pathReportsDirectory" ];
then
chmod 777 "$pathReportsDirectory"
else
mkdir "$pathReportsDirectory"
chmod 777 "$pathReportsDirectory"
fi
if [ -d "$pathReportsDirectoryForHost" ];
then
chmod 777 "$pathReportsDirectoryForHost"
else
mkdir "$pathReportsDirectoryForHost"
chmod 777 "$pathReportsDirectoryForHost"
fi
searchfile=$pathReportsDirectoryForHost/"alltests-fails.html"
endPoint="http://*:*/WebStore1S/warehouse.svc"
pathTestdataDirectory=$pathZabbixDirectory/"$6"
workSpaceName="$7"
testSuiteName="ShinaTestSuite"
testCaseName="ShinaTestCase"
commandString="$pathSoapUIDirectory/testrunner.sh -e $endPoint -s $testSuiteName"
if [ -n "$testCaseName" ]
then
commandString=${commandString}" -c $testCaseName"
fi
commandString=${commandString}" -r -j -f $pathReportsDirectoryForHost"
if [ -n "$pathTestdataDirectory" ]
then
commandString=${commandString}" -P pathTestData=$pathTestdataDirectory -P varSpace=$workSpaceName"
fi
commandString=${commandString}" -I $pathSoapUiProjectWithName"
$commandString > $pathReportsDirectoryForHost/"$2RunLogs.txt"
if [ $? -ne 0 ];
then
echo "ErrorOfRunProject"
else
if [ ! -f "$searchfile" ]
then
echo "FileNotFound"
else
if grep -w "Failure" "$searchfile" > /dev/null; then
echo "TestFailure"
else
echo "OK"
fi
fi
fi
Поставил soapuipro 5.1.1.И создал скрипт для выполнения проверок.В забиксе сделал внешнюю проверку. Из командной строки linux скрипт отрабатывает и создаёт нужные отчёты и проверки. Из под Забикса творится чертовщина, а именно эта ошибка
Missing SoapUI project file.. ErrorOfRunProject
Если меняю оболочку на
#!/bin/bash
то вылетает такое
ShinaTest.sh: line 47: $pathReportsDirectoryForHost/"$2RunLogs.txt": ambiguous redirect ErrorOfRunProject
в Забиксе запускается скрипт так
ShinaTest.sh["{HOSTNAME}"]
my script
#!/bin/sh
pathSoapUIDirectory=/opt/SoapUI-Pro-5.1.1/bin/
pathZabbixDirectory=/usr/lib/zabbix/externalscripts
pathSoapUiProjectWithName=$pathZabbixDirectory/"Shina-soapui-project.xml"
pathParentReportDir=/tmp/SoapReport
pathReportsDirectory=$pathParentReportDir/"Shina-soapui-project"
pathReportsDirectoryForHost=$pathReportsDirectory/"$1"
if [ -d "$pathParentReportDir" ];
then
chmod 777 "$pathParentReportDir"
else
mkdir "$pathParentReportDir"
chmod 777 "$pathParentReportDir"
fi
if [ -d "$pathReportsDirectory" ];
then
chmod 777 "$pathReportsDirectory"
else
mkdir "$pathReportsDirectory"
chmod 777 "$pathReportsDirectory"
fi
if [ -d "$pathReportsDirectoryForHost" ];
then
chmod 777 "$pathReportsDirectoryForHost"
else
mkdir "$pathReportsDirectoryForHost"
chmod 777 "$pathReportsDirectoryForHost"
fi
searchfile=$pathReportsDirectoryForHost/"alltests-fails.html"
endPoint="http://*:*/WebStore1S/warehouse.svc"
pathTestdataDirectory=$pathZabbixDirectory/"$6"
workSpaceName="$7"
testSuiteName="ShinaTestSuite"
testCaseName="ShinaTestCase"
commandString="$pathSoapUIDirectory/testrunner.sh -e $endPoint -s $testSuiteName"
if [ -n "$testCaseName" ]
then
commandString=${commandString}" -c $testCaseName"
fi
commandString=${commandString}" -r -j -f $pathReportsDirectoryForHost"
if [ -n "$pathTestdataDirectory" ]
then
commandString=${commandString}" -P pathTestData=$pathTestdataDirectory -P varSpace=$workSpaceName"
fi
commandString=${commandString}" -I $pathSoapUiProjectWithName"
$commandString > $pathReportsDirectoryForHost/"$2RunLogs.txt"
if [ $? -ne 0 ];
then
echo "ErrorOfRunProject"
else
if [ ! -f "$searchfile" ]
then
echo "FileNotFound"
else
if grep -w "Failure" "$searchfile" > /dev/null; then
echo "TestFailure"
else
echo "OK"
fi
fi
fi