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

Refactor SmartREST operation handling into CumulocityConverter #1942

Merged
merged 1 commit into from
May 4, 2023

Conversation

albinsuresh
Copy link
Contributor

@albinsuresh albinsuresh commented May 3, 2023

Proposed changes

Refactor standalone SmartREST message handling functions into CumulocityConverter.

Follow-up task from #1922 (comment)

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


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

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Robot Results

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

Passed Tests

Name ⏱️ Duration Suite
Define Child device 1 ID 0.01 s C8Y Child Alarms Rpi
Normal case when the child device does not exist on c8y cloud 3.268 s C8Y Child Alarms Rpi
Normal case when the child device already exists 1.6840000000000002 s C8Y Child Alarms Rpi
Reconciliation when the new alarm message arrives, restart the mapper 2.38 s C8Y Child Alarms Rpi
Reconciliation when the alarm that is cleared 66.912 s C8Y Child Alarms Rpi
Prerequisite Parent 83.164 s Child Conf Mgmt Plugin
Prerequisite Child 0.883 s Child Conf Mgmt Plugin
Child device bootstrapping 18.328 s Child Conf Mgmt Plugin
Snapshot from device 61.454 s Child Conf Mgmt Plugin
Child device config update 63.219 s Child Conf Mgmt Plugin
Configuration types should be detected on file change (without restarting service) 130.68 s Inotify Crate
Check lock file existence in default folder 2.963 s Lock File
Check PID number in lock file 2.621 s Lock File
Check PID number in lock file after restarting the services 2.456 s Lock File
Check starting same service twice 1.278 s Lock File
Switch off lock file creation 1.776 s Lock File
Set configuration when file exists 53.591 s Configuration Operation
Set configuration when file does not exist 5.463 s Configuration Operation
Set configuration with broken url 6.703 s Configuration Operation
Get configuration 8.577 s Configuration Operation
Get non existent configuration file 7.896 s Configuration Operation
Get non existent configuration type 7.949 s Configuration Operation
Update configuration plugin config via cloud 6.709 s Configuration Operation
Modify configuration plugin config via local filesystem modify inplace 5.658 s Configuration Operation
Modify configuration plugin config via local filesystem overwrite 3.865 s Configuration Operation
Update configuration plugin config via local filesystem copy 4.098 s Configuration Operation
Update configuration plugin config via local filesystem move (different directory) 3.765 s Configuration Operation
Update configuration plugin config via local filesystem move (same directory) 3.899 s Configuration Operation
Successful firmware operation 89.562 s Firmware Operation
Install with empty firmware name 55.343 s Firmware Operation
Prerequisite Parent 20.984 s Firmware Operation Child Device
Prerequisite Child 8.533 s Firmware Operation Child Device
Child device firmware update 4.752 s Firmware Operation Child Device
Child device firmware update with cache 6.639 s Firmware Operation Child Device
Firmware plugin supports restart via service manager #1932 5.945 s Firmware Operation Child Device Retry
Update Inventory data via inventory.json 2.123 s Inventory Update
Retrieve a JWT tokens 129.232 s Jwt Request
Check running collectd 1.366 s Monitor Device Collectd
Is collectd publishing MQTT messages? 3.011 s Monitor Device Collectd
Check thin-edge monitoring 3.491 s Monitor Device Collectd
Check grouping of measurements 8.875 s Monitor Device Collectd
Main device registration 2.8 s Device Registration
Child device registration 3.3890000000000002 s Device Registration
Supports restarting the device 135.244 s Restart Device
Update tedge version from previous using Cumulocity 129.511 s Tedge Self Update
Test if all c8y services are up 136.573 s Service Monitoring
Test if all c8y services are down 129.833 s Service Monitoring
Test if all c8y services are using configured service type 121.036 s Service Monitoring
Test if all c8y services using default service type when service type configured as empty 94.845 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker stop start 27.97 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker restart 30.079 s Service Monitoring
Check health status of child device service 27.67 s Service Monitoring
Successful shell command with output 4.557 s Shell Operation
Check Successful shell command with literal double quotes output 3.906 s Shell Operation
Execute multiline shell command 3.691 s Shell Operation
Failed shell command 3.949 s Shell Operation
Software list should be populated during startup 69.731 s Software
Install software via Cumulocity 90.998 s Software
Software list should only show currently installed software and not candidates 51.363 s Software
Child devices support sending simple measurements 2.125 s Child Device Telemetry
Child devices support sending custom measurements 1.5979999999999999 s Child Device Telemetry
Child devices support sending custom events 1.682 s Child Device Telemetry
Child devices support sending custom events overriding the type 1.7389999999999999 s Child Device Telemetry
Child devices support sending custom alarms #1699 1.738 s Child Device Telemetry
Child devices support sending inventory data via c8y topic 1.435 s Child Device Telemetry
Main device support sending inventory data via c8y topic 2.042 s Child Device Telemetry
Child device supports sending custom child device measurements directly to c8y 1.9769999999999999 s Child Device Telemetry
Main device supports sending custom child device measurements directly to c8y 2.288 s Child Device Telemetry
Check retained alarms 64.66 s Raise Alarms
Validate updated data path used by tedge-agent 0.832 s Data Path Config
Validate updated data path used by c8y-firmware-plugin 12.602 s Data Path Config
Stop tedge-agent service 0.537 s Log Path Config
Customize the log path 0.192 s Log Path Config
Initialize tedge-agent 0.306 s Log Path Config
Check created folders 0.202 s Log Path Config
Remove created custom folders 0.178 s Log Path Config
Install thin-edge via apt 70.413 s Install Apt
Install latest via script (from current branch) 37.255 s Install Tedge
Install specific version via script (from current branch) 34.427 s Install Tedge
Install latest tedge via script (from main branch) 34.275 s Install Tedge
Install then uninstall latest tedge via script (from main branch) 81.715 s Install Tedge
Support starting and stopping services 53.172 s Service-Control
Supports a reconnect 72.161 s Test-Commands
Supports disconnect then connect 49.037 s Test-Commands
Update unknown setting 58.811 s Test-Commands
Update known setting 37.872 s Test-Commands
Stop c8y-configuration-plugin 60.482 s Health C8Y-Configuration-Plugin
Update the service file 0.523 s Health C8Y-Configuration-Plugin
Reload systemd files 1.213 s Health C8Y-Configuration-Plugin
Start c8y-configuration-plugin 0.311 s Health C8Y-Configuration-Plugin
Start watchdog service 10.647 s Health C8Y-Configuration-Plugin
Check PID of c8y-configuration-plugin 0.19 s Health C8Y-Configuration-Plugin
Kill the PID 0.39 s Health C8Y-Configuration-Plugin
Recheck PID of c8y-configuration-plugin 6.721 s Health C8Y-Configuration-Plugin
Compare PID change 0.004 s Health C8Y-Configuration-Plugin
Stop watchdog service 0.232 s Health C8Y-Configuration-Plugin
Remove entry from service file 0.179 s Health C8Y-Configuration-Plugin
Stop c8y-log-plugin 60.253 s Health C8Y-Log-Plugin
Update the service file 0.288 s Health C8Y-Log-Plugin
Reload systemd files 1.161 s Health C8Y-Log-Plugin
Start c8y-log-plugin 0.344 s Health C8Y-Log-Plugin
Start watchdog service 10.446 s Health C8Y-Log-Plugin
Check PID of c8y-log-plugin 0.144 s Health C8Y-Log-Plugin
Kill the PID 0.283 s Health C8Y-Log-Plugin
Recheck PID of c8y-log-plugin 6.984 s Health C8Y-Log-Plugin
Compare PID change 0.002 s Health C8Y-Log-Plugin
Stop watchdog service 0.243 s Health C8Y-Log-Plugin
Remove entry from service file 0.329 s Health C8Y-Log-Plugin
Stop tedge-mapper 0.331 s Health Tedge Mapper C8Y
Update the service file 0.272 s Health Tedge Mapper C8Y
Reload systemd files 1.012 s Health Tedge Mapper C8Y
Start tedge-mapper 0.232 s Health Tedge Mapper C8Y
Start watchdog service 10.498 s Health Tedge Mapper C8Y
Check PID of tedge-mapper 0.095 s Health Tedge Mapper C8Y
Kill the PID 0.157 s Health Tedge Mapper C8Y
Recheck PID of tedge-mapper 6.438 s Health Tedge Mapper C8Y
Compare PID change 0.001 s Health Tedge Mapper C8Y
Stop watchdog service 0.232 s Health Tedge Mapper C8Y
Remove entry from service file 0.178 s Health Tedge Mapper C8Y
Stop tedge-agent 0.135 s Health Tedge-Agent
Update the service file 0.147 s Health Tedge-Agent
Reload systemd files 0.268 s Health Tedge-Agent
Start tedge-agent 0.119 s Health Tedge-Agent
Start watchdog service 10.164 s Health Tedge-Agent
Check PID of tedge-mapper 0.143 s Health Tedge-Agent
Kill the PID 0.322 s Health Tedge-Agent
Recheck PID of tedge-agent 6.602 s Health Tedge-Agent
Compare PID change 0.002 s Health Tedge-Agent
Stop watchdog service 0.162 s Health Tedge-Agent
Remove entry from service file 0.145 s Health Tedge-Agent
Stop tedge-mapper-az 0.283 s Health Tedge-Mapper-Az
Update the service file 0.258 s Health Tedge-Mapper-Az
Reload systemd files 0.964 s Health Tedge-Mapper-Az
Start tedge-mapper-az 0.421 s Health Tedge-Mapper-Az
Start watchdog service 10.267 s Health Tedge-Mapper-Az
Check PID of tedge-mapper-az 0.129 s Health Tedge-Mapper-Az
Kill the PID 0.221 s Health Tedge-Mapper-Az
Recheck PID of tedge-agent 7.175 s Health Tedge-Mapper-Az
Compare PID change 0.001 s Health Tedge-Mapper-Az
Stop watchdog service 0.469 s Health Tedge-Mapper-Az
Remove entry from service file 0.22 s Health Tedge-Mapper-Az
Stop tedge-mapper-collectd 0.185 s Health Tedge-Mapper-Collectd
Update the service file 0.188 s Health Tedge-Mapper-Collectd
Reload systemd files 0.724 s Health Tedge-Mapper-Collectd
Start tedge-mapper-collectd 0.535 s Health Tedge-Mapper-Collectd
Start watchdog service 10.279 s Health Tedge-Mapper-Collectd
Check PID of tedge-mapper-collectd 0.138 s Health Tedge-Mapper-Collectd
Kill the PID 0.222 s Health Tedge-Mapper-Collectd
Recheck PID of tedge-mapper-collectd 6.782 s Health Tedge-Mapper-Collectd
Compare PID change 0.029 s Health Tedge-Mapper-Collectd
Stop watchdog service 0.254 s Health Tedge-Mapper-Collectd
Remove entry from service file 0.336 s Health Tedge-Mapper-Collectd
tedge-collectd-mapper health status 6.208 s Health Tedge-Mapper-Collectd
c8y-log-plugin health status 6.463 s MQTT health endpoints
c8y-configuration-plugin health status 6.143 s MQTT health endpoints
Publish on a local insecure broker 0.624 s Basic Pub Sub
Publish on a local secure broker 5.426 s Basic Pub Sub
Publish on a local secure broker with client authentication 3.71 s Basic Pub Sub
Check remote mqtt broker #1773 5.833 s Remote Mqtt Broker
Wrong package name 0.139 s Improve Tedge Apt Plugin Error Messages
Wrong version 0.155 s Improve Tedge Apt Plugin Error Messages
Wrong type 0.38 s Improve Tedge Apt Plugin Error Messages
tedge_connect_test_positive 0.539 s Tedge Connect Test
tedge_connect_test_negative 1.647 s Tedge Connect Test
tedge_connect_test_sm_services 7.53 s Tedge Connect Test
tedge_disconnect_test_sm_services 60.45 s Tedge Connect Test
Install thin-edge.io 31.076 s Call Tedge
call tedge -V 0.127 s Call Tedge
call tedge -h 0.16 s Call Tedge
call tedge -h -V 0.186 s Call Tedge
call tedge help 0.148 s Call Tedge
tedge config list 0.113 s Call Tedge Config List
tedge config list --all 0.099 s Call Tedge Config List
set/unset device.type 0.391 s Call Tedge Config List
set/unset device.key.path 0.338 s Call Tedge Config List
set/unset device.cert.path 0.546 s Call Tedge Config List
set/unset c8y.root.cert.path 0.388 s Call Tedge Config List
set/unset c8y.smartrest.templates 0.557 s Call Tedge Config List
set/unset az.root.cert.path 0.523 s Call Tedge Config List
set/unset az.mapper.timestamp 0.496 s Call Tedge Config List
set/unset mqtt.bind_address 0.517 s Call Tedge Config List
set/unset mqtt.port 0.94 s Call Tedge Config List
set/unset tmp.path 0.739 s Call Tedge Config List
set/unset logs.path 0.983 s Call Tedge Config List
set/unset run.path 0.71 s Call Tedge Config List
Get Put Delete 4.783 s Http File Transfer Api
Set keys should return value on stdout 0.295 s Tedge Config Get
Unset keys should not return anything on stdout and warnings on stderr 0.381 s Tedge Config Get
Invalid keys should not return anything on stdout and warnings on stderr 0.255 s Tedge Config Get
Set configuration via environment variables 0.72 s Tedge Config Get
Set unknown configuration via environment variables 0.078 s Tedge Config Get

@reubenmiller
Copy link
Contributor

@albinsuresh, one of the failing integration tests (Firmware plugin should resend the firmware update request after being restarted) will be fixed by rebasing.

The other seems to be a flakey test (where rerunning the tests should pass eventually)...we will address the flakey integration test soon.

Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved.

@albinsuresh albinsuresh force-pushed the c8y-mapper-refactoring branch from 531b675 to 90118aa Compare May 4, 2023 06:45
@albinsuresh albinsuresh force-pushed the c8y-mapper-refactoring branch from 90118aa to 3cd1321 Compare May 4, 2023 11:51
@albinsuresh albinsuresh temporarily deployed to Test Pull Request May 4, 2023 11:59 — with GitHub Actions Inactive
@albinsuresh albinsuresh merged commit 25d8478 into thin-edge:main May 4, 2023
@albinsuresh albinsuresh deleted the c8y-mapper-refactoring branch May 18, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants