Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(lock): improve pid detection logic by using more precise matches #2126

Merged

Conversation

reubenmiller
Copy link
Contributor

Proposed changes

Reduce false positives when getting the Process ID (PID) in integration tests. Previously the pgrep command could match additional processes (such as the pgrep command itself). Now a more exact matching is used to only check processes starting with /usr/bin/ etc.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


#2087

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@reubenmiller reubenmiller changed the title tests(lock): improve pid detection logic to use more exact matches tests(lock): improve pid detection logic to use more precise matches Aug 4, 2023
@reubenmiller reubenmiller force-pushed the test-improve-pid-matching-logic branch from b2e6f37 to 2e48497 Compare August 4, 2023 08:02
@reubenmiller reubenmiller changed the title tests(lock): improve pid detection logic to use more precise matches tests(lock): improve pid detection logic by using more precise matches Aug 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
241 0 5 241 100

Passed Tests

Name ⏱️ Duration Suite
Prerequisite Parent 17.269 s Child Conf Mgmt Plugin
Prerequisite Child 0.472 s Child Conf Mgmt Plugin
Child device bootstrapping 14.927 s Child Conf Mgmt Plugin
Snapshot from device 61.704 s Child Conf Mgmt Plugin
Child device config update 63.096 s Child Conf Mgmt Plugin
Configuration types should be detected on file change (without restarting service) 53.154 s Inotify Crate
Check lock file existence in default folder 1.464 s Lock File
Check PID number in lock file 1.446 s Lock File
Check PID number in lock file after restarting the services 2.7640000000000002 s Lock File
Check starting same service twice 1.717 s Lock File
Switch off lock file creation 3.629 s Lock File
Set configuration when file exists 7.016 s Configuration Operation
Set configuration when file does not exist 7.077 s Configuration Operation
Set configuration with broken url 5.665 s Configuration Operation
Get configuration 7.372 s Configuration Operation
Get non existent configuration file 5.874 s Configuration Operation
Get non existent configuration type 5.116 s Configuration Operation
Update configuration plugin config via cloud 5.518 s Configuration Operation
Modify configuration plugin config via local filesystem modify inplace 2.589 s Configuration Operation
Modify configuration plugin config via local filesystem overwrite 3.553 s Configuration Operation
Update configuration plugin config via local filesystem copy 4.527 s Configuration Operation
Update configuration plugin config via local filesystem move (different directory) 4.074 s Configuration Operation
Update configuration plugin config via local filesystem move (same directory) 4.2620000000000005 s Configuration Operation
Update the custom operation dynamically 58.811 s Dynamically Reload Operation
Custom operation successful 125.758 s Custom Operation
Custom operation fails 62.337 s Custom Operation
Successful firmware operation 131.636 s Firmware Operation
Install with empty firmware name 40.056 s Firmware Operation
Prerequisite Parent 19.574 s Firmware Operation Child Device
Prerequisite Child 8.775 s Firmware Operation Child Device
Child device firmware update 4.851 s Firmware Operation Child Device
Child device firmware update with cache 6.686 s Firmware Operation Child Device
Firmware plugin supports restart via service manager #1932 5.132 s Firmware Operation Child Device Retry
Update Inventory data via inventory.json 2.907 s Inventory Update
Inventory includes the agent fragment with version information 1.939 s Inventory Update
Retrieve a JWT tokens 36.001 s Jwt Request
Mapper recovers and processes output of ongoing software update request 16.388 s Recover And Publish Software Update Message
Check running collectd 1.546 s Monitor Device Collectd
Is collectd publishing MQTT messages? 3.048 s Monitor Device Collectd
Check thin-edge monitoring 6.23 s Monitor Device Collectd
Check grouping of measurements 8.692 s Monitor Device Collectd
Main device registration 2.916 s Device Registration
Child device registration 2.928 s Device Registration
Supports restarting the device 111.557 s Restart Device
Update tedge version from previous using Cumulocity 74.178 s Tedge Self Update
Test if all c8y services are up 104.594 s Service Monitoring
Test if all c8y services are down 108.253 s Service Monitoring
Test if all c8y services are using configured service type 177.854 s Service Monitoring
Test if all c8y services using default service type when service type configured as empty 150.292 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker stop start 23.075 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker restart 24.181 s Service Monitoring
Check health status of child device service 18.847 s Service Monitoring
Successful shell command with output 4.766 s Shell Operation
Check Successful shell command with literal double quotes output 3.84 s Shell Operation
Execute multiline shell command 3.721 s Shell Operation
Failed shell command 3.77 s Shell Operation
Software list should be populated during startup 37.736 s Software
Install software via Cumulocity 39.356 s Software
tedge-agent should terminate on SIGINT while downloading file 35.466 s Software
Software list should only show currently installed software and not candidates 40.771 s Software
Create and publish the tedge agent supported operations on mapper restart 38.414 s Mapper-Publishing-Agent-Supported-Ops
Agent gets the software list request once it comes up 27.253 s Mapper-Publishing-Agent-Supported-Ops
Define Child device 1 ID 0.005 s C8Y Child Alarms Rpi
Normal case when the child device does not exist on c8y cloud 4.846 s C8Y Child Alarms Rpi
Normal case when the child device already exists 0.933 s C8Y Child Alarms Rpi
Reconciliation when the new alarm message arrives, restart the mapper 1.192 s C8Y Child Alarms Rpi
Reconciliation when the alarm that is cleared 65.702 s C8Y Child Alarms Rpi
Child devices support sending simple measurements 1.9609999999999999 s Child Device Telemetry
Child devices support sending custom measurements 3.542 s Child Device Telemetry
Child devices support sending custom events 1.41 s Child Device Telemetry
Child devices support sending custom events overriding the type 1.4729999999999999 s Child Device Telemetry
Child devices support sending custom alarms #1699 1.528 s Child Device Telemetry
Child devices support sending inventory data via c8y topic 1.599 s Child Device Telemetry
Child device supports sending custom child device measurements directly to c8y 2.052 s Child Device Telemetry
Check retained alarms 216.996 s Raise Alarms
Thin-edge devices support sending simple measurements 1.763 s Thin-Edge Device Telemetry
Thin-edge devices support sending simple measurements with custom type 1.466 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom measurements 1.7 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom events 1.67 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom events overriding the type 1.393 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom alarms #1699 3.605 s Thin-Edge Device Telemetry
Thin-edge device supports sending custom Thin-edge device measurements directly to c8y 2.032 s Thin-Edge Device Telemetry
Thin-edge device support sending inventory data via c8y topic 1.7189999999999999 s Thin-Edge Device Telemetry
thin-edge components support a custom config-dir location via flags 26.784 s Config Dir
Validate updated data path used by tedge-agent 0.348 s Data Path Config
Validate updated data path used by c8y-firmware-plugin 10.985 s Data Path Config
Validate updated data path used by tedge-agent 0.446 s Log Path Config
Check existence of init directories 0.63 s Tedge Init
Tedge init and check creation of folders 1.052 s Tedge Init
Check ownership of the folders 1.047 s Tedge Init
Change user/group and check the change 1.41 s Tedge Init
Tedge init and check if default values are restored 1.891 s Tedge Init
Install thin-edge via apt 48.912 s Install Apt
Install latest via script (from current branch) 29.058 s Install Tedge
Install specific version via script (from current branch) 27.139 s Install Tedge
Install latest tedge via script (from main branch) 23.271 s Install Tedge
Install then uninstall latest tedge via script (from main branch) 69.056 s Install Tedge
Support starting and stopping services 37.218 s Service-Control
Supports a reconnect 53.502 s Test-Commands
Supports disconnect then connect 38.421 s Test-Commands
Update unknown setting 39.304 s Test-Commands
Update known setting 45.101 s Test-Commands
It checks MQTT messages using a pattern 67.188 s Test-Mqtt
Stop c8y-configuration-plugin 0.117 s Health C8Y-Configuration-Plugin
Update the service file 0.113 s Health C8Y-Configuration-Plugin
Reload systemd files 0.531 s Health C8Y-Configuration-Plugin
Start c8y-configuration-plugin 0.214 s Health C8Y-Configuration-Plugin
Start watchdog service 10.232 s Health C8Y-Configuration-Plugin
Check PID of c8y-configuration-plugin 0.122 s Health C8Y-Configuration-Plugin
Kill the PID 0.302 s Health C8Y-Configuration-Plugin
Recheck PID of c8y-configuration-plugin 6.629 s Health C8Y-Configuration-Plugin
Compare PID change 0.02 s Health C8Y-Configuration-Plugin
Stop watchdog service 0.205 s Health C8Y-Configuration-Plugin
Remove entry from service file 0.157 s Health C8Y-Configuration-Plugin
Stop c8y-log-plugin 0.091 s Health C8Y-Log-Plugin
Update the service file 0.107 s Health C8Y-Log-Plugin
Reload systemd files 0.239 s Health C8Y-Log-Plugin
Start c8y-log-plugin 0.146 s Health C8Y-Log-Plugin
Start watchdog service 10.166 s Health C8Y-Log-Plugin
Check PID of c8y-log-plugin 0.109 s Health C8Y-Log-Plugin
Kill the PID 0.33 s Health C8Y-Log-Plugin
Recheck PID of c8y-log-plugin 6.612 s Health C8Y-Log-Plugin
Compare PID change 0.002 s Health C8Y-Log-Plugin
Stop watchdog service 0.139 s Health C8Y-Log-Plugin
Remove entry from service file 0.254 s Health C8Y-Log-Plugin
Stop tedge-mapper 0.092 s Health Tedge Mapper C8Y
Update the service file 0.063 s Health Tedge Mapper C8Y
Reload systemd files 0.229 s Health Tedge Mapper C8Y
Start tedge-mapper 0.073 s Health Tedge Mapper C8Y
Start watchdog service 10.093 s Health Tedge Mapper C8Y
Check PID of tedge-mapper 0.163 s Health Tedge Mapper C8Y
Kill the PID 0.29 s Health Tedge Mapper C8Y
Recheck PID of tedge-mapper 6.851 s Health Tedge Mapper C8Y
Compare PID change 0.001 s Health Tedge Mapper C8Y
Stop watchdog service 0.461 s Health Tedge Mapper C8Y
Remove entry from service file 0.229 s Health Tedge Mapper C8Y
Stop tedge-agent 0.119 s Health Tedge-Agent
Update the service file 0.085 s Health Tedge-Agent
Reload systemd files 0.467 s Health Tedge-Agent
Start tedge-agent 0.162 s Health Tedge-Agent
Start watchdog service 10.121 s Health Tedge-Agent
Check PID of tedge-mapper 0.175 s Health Tedge-Agent
Kill the PID 0.303 s Health Tedge-Agent
Recheck PID of tedge-agent 6.8870000000000005 s Health Tedge-Agent
Compare PID change 0.03 s Health Tedge-Agent
Stop watchdog service 0.367 s Health Tedge-Agent
Remove entry from service file 0.393 s Health Tedge-Agent
Stop tedge-mapper-az 0.247 s Health Tedge-Mapper-Az
Update the service file 0.132 s Health Tedge-Mapper-Az
Reload systemd files 0.291 s Health Tedge-Mapper-Az
Start tedge-mapper-az 0.085 s Health Tedge-Mapper-Az
Start watchdog service 10.111 s Health Tedge-Mapper-Az
Check PID of tedge-mapper-az 0.171 s Health Tedge-Mapper-Az
Kill the PID 0.501 s Health Tedge-Mapper-Az
Recheck PID of tedge-agent 7.048 s Health Tedge-Mapper-Az
Compare PID change 0.007 s Health Tedge-Mapper-Az
Stop watchdog service 0.274 s Health Tedge-Mapper-Az
Remove entry from service file 0.253 s Health Tedge-Mapper-Az
Stop tedge-mapper-collectd 0.121 s Health Tedge-Mapper-Collectd
Update the service file 0.103 s Health Tedge-Mapper-Collectd
Reload systemd files 0.367 s Health Tedge-Mapper-Collectd
Start tedge-mapper-collectd 0.163 s Health Tedge-Mapper-Collectd
Start watchdog service 10.135 s Health Tedge-Mapper-Collectd
Check PID of tedge-mapper-collectd 0.065 s Health Tedge-Mapper-Collectd
Kill the PID 0.148 s Health Tedge-Mapper-Collectd
Recheck PID of tedge-mapper-collectd 6.946 s Health Tedge-Mapper-Collectd
Compare PID change 0.001 s Health Tedge-Mapper-Collectd
Stop watchdog service 0.164 s Health Tedge-Mapper-Collectd
Remove entry from service file 0.121 s Health Tedge-Mapper-Collectd
tedge-collectd-mapper health status 5.946 s Health Tedge-Mapper-Collectd
c8y-log-plugin health status 5.634 s MQTT health endpoints
c8y-configuration-plugin health status 6.01 s MQTT health endpoints
Publish on a local insecure broker 0.361 s Basic Pub Sub
Publish on a local secure broker 2.11 s Basic Pub Sub
Publish on a local secure broker with client authentication 3.601 s Basic Pub Sub
Publish events to subscribed topic 0.25 s Custom Sub Topics Tedge-Mapper-Aws
Publish measurements to unsubscribed topic 5.207 s Custom Sub Topics Tedge-Mapper-Aws
Publish measurements to subscribed topic 0.283 s Custom Sub Topics Tedge-Mapper-Az
Publish measurements to unsubscribed topic 5.41 s Custom Sub Topics Tedge-Mapper-Az
Publish events to subscribed topic 0.398 s Custom Sub Topics Tedge-Mapper-C8Y
Publish measurements to unsubscribed topic 5.379 s Custom Sub Topics Tedge-Mapper-C8Y
Check remote mqtt broker #1773 3.616 s Remote Mqtt Broker
Apply name filter 0.205 s Filter Packages List Output
Apply maintainer filter 0.166 s Filter Packages List Output
Apply both filters 0.212 s Filter Packages List Output
No filters 0.105 s Filter Packages List Output
Both filters but name filter as empty string 0.127 s Filter Packages List Output
Both filters but maintainer filter as empty string 0.195 s Filter Packages List Output
Both filters as empty string 0.132 s Filter Packages List Output
Wrong package name 0.204 s Improve Tedge Apt Plugin Error Messages
Wrong version 0.184 s Improve Tedge Apt Plugin Error Messages
Wrong type 0.556 s Improve Tedge Apt Plugin Error Messages
tedge_connect_test_positive 0.427 s Tedge Connect Test
tedge_connect_test_negative 1.141 s Tedge Connect Test
tedge_connect_test_sm_services 8.352 s Tedge Connect Test
tedge_disconnect_test_sm_services 60.527 s Tedge Connect Test
Install thin-edge.io 25.062 s Call Tedge
call tedge -V 0.078 s Call Tedge
call tedge -h 0.103 s Call Tedge
call tedge -h -V 0.121 s Call Tedge
call tedge help 0.083 s Call Tedge
tedge config list 0.114 s Call Tedge Config List
tedge config list --all 0.15 s Call Tedge Config List
set/unset device.type 0.544 s Call Tedge Config List
set/unset device.key_path 0.464 s Call Tedge Config List
set/unset device.cert_path 0.544 s Call Tedge Config List
set/unset c8y.root_cert_path 0.685 s Call Tedge Config List
set/unset c8y.smartrest.templates 0.743 s Call Tedge Config List
set/unset c8y.topics 0.884 s Call Tedge Config List
set/unset az.root_cert_path 0.664 s Call Tedge Config List
set/unset az.topics 0.507 s Call Tedge Config List
set/unset aws.topics 0.69 s Call Tedge Config List
set/unset aws.url 0.566 s Call Tedge Config List
set/unset aws.root_cert_path 0.694 s Call Tedge Config List
set/unset aws.mapper.timestamp 0.389 s Call Tedge Config List
set/unset az.mapper.timestamp 0.417 s Call Tedge Config List
set/unset mqtt.bind.address 0.453 s Call Tedge Config List
set/unset mqtt.bind.port 0.716 s Call Tedge Config List
set/unset http.bind.port 0.537 s Call Tedge Config List
set/unset tmp.path 0.407 s Call Tedge Config List
set/unset logs.path 0.336 s Call Tedge Config List
set/unset run.path 0.282 s Call Tedge Config List
set/unset firmware.child.update.timeout 0.247 s Call Tedge Config List
set/unset c8y.url 0.241 s Call Tedge Config List
set/unset az.url 0.234 s Call Tedge Config List
set/unset mqtt.external.bind.port 0.247 s Call Tedge Config List
mqtt.external.bind.address 0.251 s Call Tedge Config List
mqtt.external.bind.interface 0.248 s Call Tedge Config List
set/unset mqtt.external.ca_path 0.25 s Call Tedge Config List
set/unset mqtt.external.cert_file 0.264 s Call Tedge Config List
set/unset mqtt.external.key_file 0.27 s Call Tedge Config List
set/unset software.plugin.default 0.216 s Call Tedge Config List
set/unset apt.name 0.286 s Call Tedge Config List
set/unset apt.maintainer 0.264 s Call Tedge Config List
Get Put Delete 2.472 s Http File Transfer Api
Set keys should return value on stdout 0.169 s Tedge Config Get
Unset keys should not return anything on stdout and warnings on stderr 0.374 s Tedge Config Get
Invalid keys should not return anything on stdout and warnings on stderr 0.334 s Tedge Config Get
Set configuration via environment variables 1.324 s Tedge Config Get
Set configuration via environment variables for topics 0.48 s Tedge Config Get
Set unknown configuration via environment variables 0.204 s Tedge Config Get

Copy link
Contributor

@gligorisaev gligorisaev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. health_c8y-configuration-plugin.robot - ok
  2. health_c8y-log-plugin.robot - o k
  3. health_tedge_mapper_c8y.robot - ok
  4. health_tedge_agent.robot - ok
  5. health_tedge_mapper_az.robot - ok
  6. health_tedge_mapper_collectd.robot - ok
  7. MQTT_health_endpoints.robot - ok
  8. lock_file.robot - ok

@reubenmiller reubenmiller temporarily deployed to Test Pull Request August 4, 2023 09:35 — with GitHub Actions Inactive
@reubenmiller reubenmiller merged commit 67511f9 into thin-edge:main Aug 4, 2023
16 checks passed
@reubenmiller reubenmiller deleted the test-improve-pid-matching-logic branch August 4, 2023 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants