ble - fixing test_driver after cleanup
This commit is contained in:
1 parent
1dff4d71b6
commit
72c878e8e8
2 files changed
+11
-10
No files matched your search
@@ -38,8 +38,8 @@ pipeline {
|
|||||||
|
|
||||||
sh """
|
sh """
|
||||||
cd /tmp
|
cd /tmp
|
||||||
echo Test Hash - ${env.TEST_HASH}
|
echo ==MC== Test Hash - ${env.TEST_HASH}
|
||||||
echo Disabling MOTD...
|
echo ==MC== Disabling MOTD...
|
||||||
touch .hushlogin
|
touch .hushlogin
|
||||||
scp .hushlogin root@${params.host_ip}:/root/.hushlogin
|
scp .hushlogin root@${params.host_ip}:/root/.hushlogin
|
||||||
|
|
||||||
@@ -57,9 +57,9 @@ pipeline {
|
|||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
sh """
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||||
echo Checking for screen application...
|
echo ==MC== Checking for screen application...
|
||||||
if ! command -v screen > /dev/null; then
|
if ! command -v screen > /dev/null; then
|
||||||
echo "screen not found - installing"
|
echo ==MC== "screen not found - installing"
|
||||||
apt-get update && apt-get install -y screen
|
apt-get update && apt-get install -y screen
|
||||||
fi
|
fi
|
||||||
"""
|
"""
|
||||||
@@ -75,9 +75,9 @@ pipeline {
|
|||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
sh """
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||||
echo Initiating BLE test in Screen session ble_test_${env.TEST_HASH}
|
echo ==MC== Initiating BLE test in Screen session ble_test_${env.TEST_HASH}
|
||||||
sleep 5
|
sleep 5
|
||||||
echo Pulling code changes from Gitea...
|
echo ==MC== Pulling code changes from Gitea...
|
||||||
cd /opt/ble-test/ble_api
|
cd /opt/ble-test/ble_api
|
||||||
git pull
|
git pull
|
||||||
cd /opt/ble-test/ble_api/api
|
cd /opt/ble-test/ble_api/api
|
||||||
@@ -93,7 +93,7 @@ pipeline {
|
|||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
sh """
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||||
echo === Initiating Tail Watchdog ===
|
echo ==MC== Initiating Tail Watchdog
|
||||||
screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c '
|
screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c '
|
||||||
while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
|
while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@@ -108,6 +108,7 @@ pipeline {
|
|||||||
done
|
done
|
||||||
exit
|
exit
|
||||||
'
|
'
|
||||||
|
echo ==MC== Tail watchdog running in screen session ble_test_watchdog_${env.TEST_HASH}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -319,8 +319,9 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
# If all the MACs have been scanned, then this test is complete.
|
# If all the MACs have been scanned, then this test is complete.
|
||||||
if len(mac_list) == len(passed_list):
|
if len(mac_list) == len(passed_list):
|
||||||
log.info(f" Test run {test_count} completed, yee-haw")
|
log.info(f" Test run {test_count} completed, yee-haw")
|
||||||
|
test_complete = True
|
||||||
print_sensor_data(sensors)
|
print_sensor_data(sensors)
|
||||||
return summarize_test_run(sensors)
|
return summarize_test_run(sensors, found_macs)
|
||||||
# If not, then re-scan the failed sensors
|
# If not, then re-scan the failed sensors
|
||||||
else:
|
else:
|
||||||
log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.")
|
log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.")
|
||||||
@@ -336,14 +337,13 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
# helper function for summarizing test run results
|
# helper function for summarizing test run results
|
||||||
def summarize_test_run(sensors):
|
def summarize_test_run(sensors, found_macs):
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
log.info(f" {sensor['name']} - Temp: {temp_ctof(sensor['temp'])} | Humidity: {sensor['humidity']}")
|
log.info(f" {sensor['name']} - Temp: {temp_ctof(sensor['temp'])} | Humidity: {sensor['humidity']}")
|
||||||
result = {
|
result = {
|
||||||
"found_macs": found_macs,
|
"found_macs": found_macs,
|
||||||
"sensor_results": sensors
|
"sensor_results": sensors
|
||||||
}
|
}
|
||||||
test_complete = True
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# helper function for processing failed tests
|
# helper function for processing failed tests
|
||||||
|
|||||||
Reference in new issue
Block a user