@@ -121,6 +121,49 @@ jobs:
121121 if [ "$failed" = true ]; then exit 1; fi
122122 echo "All config.json fields validated"
123123
124+ - name : Send test command
125+ shell : bash
126+ run : |
127+ curl --location '${{ vars.IT_SEND_COMMAND_TRIGGER_URL }}' \
128+ --form 'device_id="${{ steps.get_device_id.outputs.value }}"' \
129+ --form 'commands="echo \"hello world\""'
130+
131+ - name : Check logs
132+ shell : bash
133+ run : |
134+ logFile="/etc/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
135+ logContent=$(cat "$logFile")
136+ echo "$logContent"
137+
138+ for pattern in "Command completed" "Sending postback" "Postback sent"; do
139+ if ! echo "$logContent" | grep -qF "$pattern"; then
140+ echo "ERROR: Expected log line not found: $pattern"
141+ exit 1
142+ fi
143+ done
144+ echo "All expected log lines found"
145+
146+ - name : Send failing command
147+ shell : bash
148+ run : |
149+ curl --location '${{ vars.IT_SEND_COMMAND_TRIGGER_URL }}' \
150+ --form 'device_id="${{ steps.get_device_id.outputs.value }}"' \
151+ --form 'commands="exit 1"'
152+
153+ - name : Check logs for error handling
154+ shell : bash
155+ run : |
156+ sleep 15
157+ logFile="/etc/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
158+ logContent=$(cat "$logFile")
159+ echo "$logContent"
160+
161+ if ! echo "$logContent" | grep -qF "Command failed"; then
162+ echo "ERROR: Expected 'Command failed' not found in logs"
163+ exit 1
164+ fi
165+ echo "Error handling verified: failing command error was captured"
166+
124167 - name : Install integration test binary (old version)
125168 shell : bash
126169 run : |
@@ -165,49 +208,6 @@ jobs:
165208 fi
166209 echo "Auto updater integration test passed"
167210
168- - name : Send test command
169- shell : bash
170- run : |
171- curl --location '${{ vars.IT_SEND_COMMAND_TRIGGER_URL }}' \
172- --form 'device_id="${{ steps.get_device_id.outputs.value }}"' \
173- --form 'commands="echo \"hello world\""'
174-
175- - name : Check logs
176- shell : bash
177- run : |
178- logFile="/etc/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
179- logContent=$(cat "$logFile")
180- echo "$logContent"
181-
182- for pattern in "Command completed" "Sending postback" "Postback sent"; do
183- if ! echo "$logContent" | grep -qF "$pattern"; then
184- echo "ERROR: Expected log line not found: $pattern"
185- exit 1
186- fi
187- done
188- echo "All expected log lines found"
189-
190- - name : Send failing command
191- shell : bash
192- run : |
193- curl --location '${{ vars.IT_SEND_COMMAND_TRIGGER_URL }}' \
194- --form 'device_id="${{ steps.get_device_id.outputs.value }}"' \
195- --form 'commands="exit 1"'
196-
197- - name : Check logs for error handling
198- shell : bash
199- run : |
200- sleep 15
201- logFile="/etc/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
202- logContent=$(cat "$logFile")
203- echo "$logContent"
204-
205- if ! echo "$logContent" | grep -qF "Command failed"; then
206- echo "ERROR: Expected 'Command failed' not found in logs"
207- exit 1
208- fi
209- echo "Error handling verified: failing command error was captured"
210-
211211 - name : Update logging level to debug
212212 shell : bash
213213 run : |
@@ -373,48 +373,6 @@ jobs:
373373 if ($failed) { exit 1 }
374374 Write-Output "All config.json fields validated"
375375
376- - name : Install integration test binary (old version)
377- shell : pwsh
378- run : |
379- ./dist/rewst_agent_config.win.it.exe --update --org-id ${{ vars.IT_ORG_ID }}
380- Write-Output "Installed integration test binary (version 0.0.0-it)"
381-
382- - name : Wait for auto updater to trigger and update
383- shell : pwsh
384- run : |
385- $logFile = "C:\ProgramData\RewstRemoteAgent\${{ vars.IT_ORG_ID }}\rewst_agent.log"
386- Write-Output "Waiting for auto updater to detect newer version and update..."
387- for ($i = 1; $i -le 60; $i++) {
388- $logContent = Get-Content $logFile -Raw -ErrorAction SilentlyContinue
389- if ($logContent -match [regex]::Escape("Updating agent")) {
390- Write-Output "Auto update triggered after ${i}s"
391- break
392- }
393- Start-Sleep -Seconds 2
394- }
395-
396- - name : Verify auto update completed
397- shell : pwsh
398- run : |
399- Start-Sleep -Seconds 15
400- $logFile = "C:\ProgramData\RewstRemoteAgent\${{ vars.IT_ORG_ID }}\rewst_agent.log"
401- $logContent = Get-Content $logFile -Raw
402- Write-Output $logContent
403-
404- foreach ($pattern in @("Checking for updates", "Updating agent")) {
405- if ($logContent -notmatch [regex]::Escape($pattern)) {
406- Write-Error "Expected auto update log line not found: $pattern"
407- exit 1
408- }
409- }
410-
411- $lastStartLine = ($logContent -split "`n" | Where-Object { $_ -match "Agent Smith started" } | Select-Object -Last 1)
412- if ($lastStartLine -match [regex]::Escape("version=0.0.0-it")) {
413- Write-Error "Agent is still running the integration test version after update"
414- exit 1
415- }
416- Write-Output "Auto updater integration test passed"
417-
418376 - name : Send test command
419377 shell : pwsh
420378 run : |
@@ -483,6 +441,48 @@ jobs:
483441 }
484442 Write-Output "Error handling verified: failing command error was captured"
485443
444+ - name : Install integration test binary (old version)
445+ shell : pwsh
446+ run : |
447+ ./dist/rewst_agent_config.win.it.exe --update --org-id ${{ vars.IT_ORG_ID }}
448+ Write-Output "Installed integration test binary (version 0.0.0-it)"
449+
450+ - name : Wait for auto updater to trigger and update
451+ shell : pwsh
452+ run : |
453+ $logFile = "C:\ProgramData\RewstRemoteAgent\${{ vars.IT_ORG_ID }}\rewst_agent.log"
454+ Write-Output "Waiting for auto updater to detect newer version and update..."
455+ for ($i = 1; $i -le 60; $i++) {
456+ $logContent = Get-Content $logFile -Raw -ErrorAction SilentlyContinue
457+ if ($logContent -match [regex]::Escape("Updating agent")) {
458+ Write-Output "Auto update triggered after ${i}s"
459+ break
460+ }
461+ Start-Sleep -Seconds 2
462+ }
463+
464+ - name : Verify auto update completed
465+ shell : pwsh
466+ run : |
467+ Start-Sleep -Seconds 15
468+ $logFile = "C:\ProgramData\RewstRemoteAgent\${{ vars.IT_ORG_ID }}\rewst_agent.log"
469+ $logContent = Get-Content $logFile -Raw
470+ Write-Output $logContent
471+
472+ foreach ($pattern in @("Checking for updates", "Updating agent")) {
473+ if ($logContent -notmatch [regex]::Escape($pattern)) {
474+ Write-Error "Expected auto update log line not found: $pattern"
475+ exit 1
476+ }
477+ }
478+
479+ $lastStartLine = ($logContent -split "`n" | Where-Object { $_ -match "Agent Smith started" } | Select-Object -Last 1)
480+ if ($lastStartLine -match [regex]::Escape("version=0.0.0-it")) {
481+ Write-Error "Agent is still running the integration test version after update"
482+ exit 1
483+ }
484+ Write-Output "Auto updater integration test passed"
485+
486486 - name : Update logging level to debug
487487 shell : pwsh
488488 run : |
@@ -702,48 +702,6 @@ jobs:
702702 if [ "$failed" = true ]; then exit 1; fi
703703 echo "All config.json fields validated"
704704
705- - name : Install integration test binary (old version)
706- shell : bash
707- run : |
708- sudo ./dist/rewst_agent_config.mac-os.it.bin --update --org-id ${{ vars.IT_ORG_ID }}
709- echo "Installed integration test binary (version 0.0.0-it)"
710-
711- - name : Wait for auto updater to trigger and update
712- shell : bash
713- run : |
714- logFile="/Library/Application Support/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
715- echo "Waiting for auto updater to detect newer version and update..."
716- for i in $(seq 1 60); do
717- logContent=$(cat "$logFile" 2>/dev/null || true)
718- if echo "$logContent" | grep -qF "Updating agent"; then
719- echo "Auto update triggered after ${i}s"
720- break
721- fi
722- sleep 2
723- done
724-
725- - name : Verify auto update completed
726- shell : bash
727- run : |
728- sleep 15
729- logFile="/Library/Application Support/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
730- logContent=$(cat "$logFile")
731- echo "$logContent"
732-
733- for pattern in "Checking for updates" "Updating agent"; do
734- if ! echo "$logContent" | grep -qF "$pattern"; then
735- echo "ERROR: Expected auto update log line not found: $pattern"
736- exit 1
737- fi
738- done
739-
740- lastVersion=$(echo "$logContent" | grep "Agent Smith started" | tail -1)
741- if echo "$lastVersion" | grep -qF "version=0.0.0-it"; then
742- echo "ERROR: Agent is still running the integration test version after update"
743- exit 1
744- fi
745- echo "Auto updater integration test passed"
746-
747705 - name : Send test command
748706 shell : bash
749707 run : |
@@ -787,6 +745,48 @@ jobs:
787745 fi
788746 echo "Error handling verified: failing command error was captured"
789747
748+ - name : Install integration test binary (old version)
749+ shell : bash
750+ run : |
751+ sudo ./dist/rewst_agent_config.mac-os.it.bin --update --org-id ${{ vars.IT_ORG_ID }}
752+ echo "Installed integration test binary (version 0.0.0-it)"
753+
754+ - name : Wait for auto updater to trigger and update
755+ shell : bash
756+ run : |
757+ logFile="/Library/Application Support/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
758+ echo "Waiting for auto updater to detect newer version and update..."
759+ for i in $(seq 1 60); do
760+ logContent=$(cat "$logFile" 2>/dev/null || true)
761+ if echo "$logContent" | grep -qF "Updating agent"; then
762+ echo "Auto update triggered after ${i}s"
763+ break
764+ fi
765+ sleep 2
766+ done
767+
768+ - name : Verify auto update completed
769+ shell : bash
770+ run : |
771+ sleep 15
772+ logFile="/Library/Application Support/rewst_remote_agent/${{ vars.IT_ORG_ID }}/rewst_agent.log"
773+ logContent=$(cat "$logFile")
774+ echo "$logContent"
775+
776+ for pattern in "Checking for updates" "Updating agent"; do
777+ if ! echo "$logContent" | grep -qF "$pattern"; then
778+ echo "ERROR: Expected auto update log line not found: $pattern"
779+ exit 1
780+ fi
781+ done
782+
783+ lastVersion=$(echo "$logContent" | grep "Agent Smith started" | tail -1)
784+ if echo "$lastVersion" | grep -qF "version=0.0.0-it"; then
785+ echo "ERROR: Agent is still running the integration test version after update"
786+ exit 1
787+ fi
788+ echo "Auto updater integration test passed"
789+
790790 - name : Update logging level to debug
791791 shell : bash
792792 run : |
0 commit comments