Skip to content
Snippets Groups Projects
Commit 28136d26 authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

Merge branch 'issue/140' into 'development'

SCRUM#126 - Add a test option to windows

See merge request !98
parents f69e8726 29054895
No related branches found
No related tags found
2 merge requests!103Merge dev -> master,!98SCRUM#126 - Add a test option to windows
Pipeline #
......@@ -42,7 +42,7 @@ compileWin:
stage: build
artifacts:
paths:
- agent.exe
- agent-1234.exe
tags:
- windows
script:
......@@ -106,3 +106,24 @@ testOpensuse:
dependencies:
- compileUnix
testWin7:
stage: test
tags:
- windows
script:
- DIR C:\
- if exist C:\agentC3SL rmdir C:\agentC3SL /s /q
- agent-1234.exe /SILENT /VERYSILENT
- if not exist C:\agentC3SL exit 1;
- DIR C:\agentC3SL
- DIR C:\agentC3SL\bin
- copy C:\jq-win32.exe .\test
- cd .\test
- C:\agentC3SL\bin\agent-v0.0.exe --once --print > test.json
- testWin.bat
- C:\agentC3SL\uninstall_agent.exe /SILENT /VERYSILENT
- dir /b /a "C:\agentC3SL\*" | >nul findstr "^" && (echo Agent has been uninstalled) || (exit 1);
dependencies:
- compileWin
......@@ -65,18 +65,18 @@ AppVersion=0.0.0
; Create agentC3SL folder at C:\Programs Files\
DefaultDirName=C:\agentC3SL
ArchitecturesInstallIn64BitMode=x64
; OutputDir = local where agent.exe will be saved
; OutputDir = local where agent-1234.exe will be saved
OutputDir={#dest}
; OutputBaseFilename = agent.exe
OutputBaseFilename=agent
OutputBaseFilename=agent-1234
PrivilegesRequired=admin
[Files]
Source: "conf\datasid-conf.json"; DestDir: "{app}\conf"; DestName : "datasid-conf.json"; AfterInstall: change_config_file;
Source: "conf\proxy-conf.json"; DestDir: "{app}\conf"; DestName : "proxy-conf.json"; AfterInstall: change_proxy_file;
Source: "bin\agent-v0.0.exe"; DestDir : "{app}"; DestName : "bin/agent.exe"; Check: Is64BitInstallMode;
Source: "bin\agent-v0.0.exe"; DestDir: "{app}"; Check: not Is64BitInstallMode; Flags: solidbreak;
Source: "README.md"; DestDir: "{app}"; Flags: isreadme
Source: "bin\agent-v0.0.exe"; DestDir : "{app}\bin"; DestName : "agent-v0.0.exe"; Check: Is64BitInstallMode;
Source: "bin\agent-v0.0.exe"; DestDir: "{app}\bin"; DestName : "agent-v0.0.exe"; Check: not Is64BitInstallMode; Flags: solidbreak;
Source: "README.md"; DestDir: "{app}";
Source: "LICENSE"; DestDir: "{app}"
[Dirs]
Name: "{app}\tmp"
......
......@@ -94,7 +94,8 @@ function id_point() {
}
setup() {
../agent-1234.run --quiet
../agent-1234.run --quiet
cat /opt/agentC3SL/conf/datasid-conf.json
/opt/agentC3SL/agent-v* --print --once | head -n -1 > export.json
pt1=$(cat export.json | head -n -9)
echo $pt1 > inventory.json
......
@echo off
setlocal EnableDelayedExpansion
REM Verificando arquivo datasid-conf.json ...
ECHO Verificando arquivo datasid-conf.json ...
REM Check idPoint
jq-win32.exe ".idPoint==\"1234\"" C:\agentC3SL\conf\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo idPoint ok )
REM Check proxy path
jq-win32.exe ".proxyConf==\"conf/proxy-conf.json\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo proxyConf ok)
REM Check web service path
jq-win32.exe ".webService==\"www.C3Sl.ufpr.br\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else (echo webService ok)
REM Check version number
jq-win32.exe ".version==\"1.0.0\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else (echo version ok)
REM Check project name
jq-win32.exe ".project==\"simmc\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else (echo project name ok)
REM ##########################################################################################
REM Verificando arquivo proxy-conf.json ...
ECHO Verificando arquivo proxy-conf.json ...
REM Check host
jq-win32.exe ".host==\"mumm\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo host ok )
REM Check port
jq-win32.exe ".port==\"6666\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo port ok)
REM Check user
jq-win32.exe ".usr==\"ninguem\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else (echo user ok)
REM Check password
jq-win32.exe ".password==\"123mudar\"" C:\agentC3SL\datasid-conf.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else (echo password ok)
REM delete result.txt file
del result.txt
REM ##########################################################################################
REM get only data_inventory json
REM Strip out all lines below a specific line
set /a line=0
FOR /f "delims=" %%a IN (test.json) DO (
set /a line+=1
IF !line! leq 22 (
echo %%a >> result.json
)
)
REM Verificando o data_inventory json ...
ECHO Verificando o data_inventory json ...
REM Check agent version
jq-win32.exe ".data_inventory.agent_version==\"1.0.0\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo agent version ok )
REM Check disk1 size
jq-win32.exe ".data_inventory.disk1_size==29" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo disk1 size ok )
REM Check disk1 model
jq-win32.exe ".data_inventory.disk1_model==\"VBOX HARDDISK ATA Device \"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo disk1 model ok )
REM Check os disk1 used
REM Only check case it's not null
jq-win32.exe ".data_inventory.disk1_used=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo disk1 used ok )
REM Check os disk2 size
jq-win32.exe ".data_inventory.disk2_size==null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo disk2 size ok )
REM Check os disk2 model
jq-win32.exe ".data_inventory.disk2_model==null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo disk2 model ok )
REM Check os disk2 used
jq-win32.exe ".data_inventory.disk2_used==null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo disk2 used ok )
REM Check extra hds
jq-win32.exe ".data_inventory.extra_hds==0" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo extra hds ok )
REM Check id point
jq-win32.exe ".data_inventory.id_point==\"1234\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo id point ok )
REM Check mac address
jq-win32.exe ".data_inventory.mac_address==\"08:00:27:D9:F5:96\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo mac address ok )
REM Check machine type
jq-win32.exe ".data_inventory.machine_type==\"client\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo matchine type ok )
REM Check os memory
jq-win32.exe ".data_inventory.memory!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo memory ok )
REM Check mirror timestamp
jq-win32.exe ".data_inventory.mirror_timestamp!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo mirror timestamp ok )
REM Check os distro
jq-win32.exe ".data_inventory.os_distro==\"Microsoft Windows 7 Professional \"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo os distro ok )
REM Check os kernel
jq-win32.exe ".data_inventory.os_kernel==\"Windows\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo os kernel ok )
REM Check os type
jq-win32.exe ".data_inventory.os_type==\"Windows\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo os type ok )
REM Check processor
jq-win32.exe ".data_inventory.processor==\"Intel(R) Xeon(R) CPU X5660 @ 2.80GHz \"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo processor ok )
REM Check amount users
REM Case if someone open marula machine, maybe this error will failed
jq-win32.exe ".data_inventory.amount_users!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo amount users ok )
del result.txt
del result.json
REM ##########################################################################################
REM get only net_usage json
REM Strip out all lines below a specific line
set /a line=21
FOR /f "delims=" %%a IN (test.json) DO (
set /a line+=1
IF !line! geq 22 (
IF !line! leq 34 (
echo %%a >> result.json
)
)
)
REM Verificando o data_net json ...
ECHO Verificando o data_net json ...
REM Check bytes received
jq-win32.exe ".data_net.bytes_received!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo bytes received ok )
REM Check bytes transmitted
jq-win32.exe ".data_net.bytes_transmitted!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo bytes transmitted ok )
REM Check collect time
jq-win32.exe ".data_net.collect_time!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo collect time ok )
REM Check id point
jq-win32.exe ".data_net.id_point==\"1234\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo id point ok )
REM Check mac address
jq-win32.exe ".data_net.mac_address==\"08:00:27:D9:F5:96\"" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo mac address ok )
REM Check packets received
jq-win32.exe ".data_net.packets_received!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo packets received ok )
REM Check ppackets tranmitted
jq-win32.exe ".data_net.packets_tranmitted!=null" result.json > result.txt
set /p var=<result.txt
if %var%==false ( exit 1 ) else ( echo packets tranmitted ok )
del result.txt
del result.json
del test.json
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment