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

Output tedge config control messages to stderr #1771

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

Bravo555
Copy link
Contributor

Proposed changes

Move tedge config user directed messages to stderr so actual data output and user-directed messages can be more easily told apart and parsed as described in #1721.

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

Closes thin-edge#1721

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
.stdout(predicate::str::contains("device.id"));
.stderr(predicate::str::contains("device.id"));
Copy link
Contributor

Choose a reason for hiding this comment

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

The change is correct ... but the test is misleading. My first understanding has been that the device.id would be printed on stderr.

Suggested change
.stdout(predicate::str::contains("device.id"));
.stderr(predicate::str::contains("device.id"));
.stderr(predicate::str::contains("'device.id' is not set"));

Copy link
Contributor Author

@Bravo555 Bravo555 Feb 28, 2023

Choose a reason for hiding this comment

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

Looks like it's actually another error message:

failures:

---- tests::run_create_certificate stdout ----
thread 'tests::run_create_certificate' panicked at 'Unexpected stderr, failed var.contains('device.id' is not set)
├── var: The provided config key: 'device.id' is not configurable
└── var as str: The provided config key: 'device.id' is not configurable

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh true. This is read from the certificate. So let's check against is not configurable.

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
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

@reubenmiller
Copy link
Contributor

@Bravo555 @didier-wenzek I have to updated some of the integration test bootstrap script as it is failing now due to this change (that is why the integration tests are failing). I'm working on the changes and reach out to @Bravo555

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
@Bravo555 Bravo555 temporarily deployed to Test Pull Request March 3, 2023 09:53 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

Robot Results

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

Passed Tests

Name ⏱️ Duration Suite
Define Child device 1 ID 0.017 s C8Y Child Alarms Rpi
Normal case when the child device does not exist on c8y cloud 2.523 s C8Y Child Alarms Rpi
Normal case when the child device already exists 0.904 s C8Y Child Alarms Rpi
Reconciliation when the new alarm message arrives, restart the mapper 2.387 s C8Y Child Alarms Rpi
Reconciliation when the alarm that is cleared 5.64 s C8Y Child Alarms Rpi
Prerequisite Parent 18.612 s Child Conf Mgmt Plugin
Prerequisite Child 0.292 s Child Conf Mgmt Plugin
Child device bootstrapping 17.101 s Child Conf Mgmt Plugin
Snapshot from device 21.739 s Child Conf Mgmt Plugin
Child device config update 17.398 s Child Conf Mgmt Plugin
Configuration types should be detected on file change (without restarting service) 49.013 s Inotify Crate
Child devices support sending simple measurements 50.455 s Child Device Telemetry
Child devices support sending custom measurements 48.391 s Child Device Telemetry
Child devices support sending custom events 42.653 s Child Device Telemetry
Child devices support sending custom events overriding the type 33.581 s Child Device Telemetry
Child devices support sending custom alarms #1699 34.37 s Child Device Telemetry
Child devices support sending inventory data via c8y topic 23.066 s Child Device Telemetry
Main device support sending inventory data via c8y topic 24.819 s Child Device Telemetry
Successful firmware operation 66.015 s Firmware Operation
Install with empty firmware name 54.497 s Firmware Operation
Supports restarting the device 75.933 s Restart Device
Update tedge version from previous using Cumulocity 106.184 s Tedge Self Update
Successful shell command with output 4.144 s Shell Operation
Check Successful shell command with literal double quotes output 3.529 s Shell Operation
Execute multiline shell command 3.374 s Shell Operation
Failed shell command 3.288 s Shell Operation
Software list should be populated during startup 52.256 s Software
Install software via Cumulocity 70.505 s Software
Software list should only show currently installed software and not candidates 47.582 s Software
Stop tedge-agent service 0.33 s Log Path Config
Customize the log path 0.162 s Log Path Config
Initialize tedge-agent 0.245 s Log Path Config
Check created folders 0.124 s Log Path Config
Remove created custom folders 0.175 s Log Path Config
Install latest via script (from current branch) 32.034 s Install Tedge
Install specific version via script (from current branch) 18.292 s Install Tedge
Install latest tedge via script (from main branch) 25.363 s Install Tedge
Support starting and stopping services 40.565 s Service-Control
Supports a reconnect 49.446 s Test-Commands
Supports disconnect then connect 48.293 s Test-Commands
Update unknown setting 29.081 s Test-Commands
Update known setting 22.638 s Test-Commands
Stop c8y-configuration-plugin 0.314 s Health C8Y-Configuration-Plugin
Update the service file 0.252 s Health C8Y-Configuration-Plugin
Reload systemd files 1.018 s Health C8Y-Configuration-Plugin
Start c8y-configuration-plugin 0.351 s Health C8Y-Configuration-Plugin
Start watchdog service 10.328 s Health C8Y-Configuration-Plugin
Check PID of c8y-configuration-plugin 0.155 s Health C8Y-Configuration-Plugin
Kill the PID 0.192 s Health C8Y-Configuration-Plugin
Recheck PID of c8y-configuration-plugin 2.378 s Health C8Y-Configuration-Plugin
Compare PID change 0.002 s Health C8Y-Configuration-Plugin
Stop watchdog service 0.117 s Health C8Y-Configuration-Plugin
Remove entry from service file 0.161 s Health C8Y-Configuration-Plugin
Stop c8y-log-plugin 0.163 s Health C8Y-Log-Plugin
Update the service file 0.298 s Health C8Y-Log-Plugin
Reload systemd files 0.902 s Health C8Y-Log-Plugin
Start c8y-log-plugin 0.23 s Health C8Y-Log-Plugin
Start watchdog service 10.38 s Health C8Y-Log-Plugin
Check PID of c8y-log-plugin 0.077 s Health C8Y-Log-Plugin
Kill the PID 0.116 s Health C8Y-Log-Plugin
Recheck PID of c8y-log-plugin 2.168 s Health C8Y-Log-Plugin
Compare PID change 0.001 s Health C8Y-Log-Plugin
Stop watchdog service 0.08 s Health C8Y-Log-Plugin
Remove entry from service file 0.077 s Health C8Y-Log-Plugin
Stop tedge-mapper 0.253 s Health Tedge Mapper C8Y
Update the service file 0.179 s Health Tedge Mapper C8Y
Reload systemd files 1.071 s Health Tedge Mapper C8Y
Start tedge-mapper 0.272 s Health Tedge Mapper C8Y
Start watchdog service 10.233 s Health Tedge Mapper C8Y
Check PID of tedge-mapper 0.079 s Health Tedge Mapper C8Y
Kill the PID 0.049 s Health Tedge Mapper C8Y
Recheck PID of tedge-mapper 2.134 s Health Tedge Mapper C8Y
Compare PID change 0.001 s Health Tedge Mapper C8Y
Stop watchdog service 0.066 s Health Tedge Mapper C8Y
Remove entry from service file 0.056 s Health Tedge Mapper C8Y
Stop tedge-agent 0.347 s Health Tedge-Agent
Update the service file 0.189 s Health Tedge-Agent
Reload systemd files 0.703 s Health Tedge-Agent
Start tedge-agent 0.224 s Health Tedge-Agent
Start watchdog service 10.43 s Health Tedge-Agent
Check PID of tedge-mapper 0.063 s Health Tedge-Agent
Kill the PID 0.072 s Health Tedge-Agent
Recheck PID of tedge-agent 2.165 s Health Tedge-Agent
Compare PID change 0.001 s Health Tedge-Agent
Stop watchdog service 0.115 s Health Tedge-Agent
Remove entry from service file 0.081 s Health Tedge-Agent
Stop tedge-mapper-az 0.287 s Health Tedge-Mapper-Az
Update the service file 0.227 s Health Tedge-Mapper-Az
Reload systemd files 0.944 s Health Tedge-Mapper-Az
Start tedge-mapper-az 0.268 s Health Tedge-Mapper-Az
Start watchdog service 10.397 s Health Tedge-Mapper-Az
Check PID of tedge-mapper-az 0.079 s Health Tedge-Mapper-Az
Kill the PID 0.136 s Health Tedge-Mapper-Az
Recheck PID of tedge-agent 2.228 s Health Tedge-Mapper-Az
Compare PID change 0.001 s Health Tedge-Mapper-Az
Stop watchdog service 0.1 s Health Tedge-Mapper-Az
Remove entry from service file 0.101 s Health Tedge-Mapper-Az
Stop tedge-mapper-collectd 0.225 s Health Tedge-Mapper-Collectd
Update the service file 0.232 s Health Tedge-Mapper-Collectd
Reload systemd files 0.835 s Health Tedge-Mapper-Collectd
Start tedge-mapper-collectd 0.222 s Health Tedge-Mapper-Collectd
Start watchdog service 10.467 s Health Tedge-Mapper-Collectd
Check PID of tedge-mapper-collectd 0.06 s Health Tedge-Mapper-Collectd
Kill the PID 0.085 s Health Tedge-Mapper-Collectd
Recheck PID of tedge-mapper-collectd 2.222 s Health Tedge-Mapper-Collectd
Compare PID change 0.001 s Health Tedge-Mapper-Collectd
Stop watchdog service 0.148 s Health Tedge-Mapper-Collectd
Remove entry from service file 0.109 s Health Tedge-Mapper-Collectd
c8y-log-plugin health status 5.7940000000000005 s MQTT health endpoints
c8y-configuration-plugin health status 5.617 s MQTT health endpoints
Wrong package name 0.17 s Improve Tedge Apt Plugin Error Messages
Wrong version 0.187 s Improve Tedge Apt Plugin Error Messages
Wrong type 0.33 s Improve Tedge Apt Plugin Error Messages
tedge_connect_test_positive 0.564 s Tedge Connect Test
tedge_connect_test_negative 1.189 s Tedge Connect Test
tedge_connect_test_sm_services 7.299 s Tedge Connect Test
tedge_disconnect_test_sm_services 0.859 s Tedge Connect Test
Install thin-edge.io 16.246 s Call Tedge
call tedge -V 0.069 s Call Tedge
call tedge -h 0.073 s Call Tedge
call tedge -h -V 0.079 s Call Tedge
call tedge help 0.089 s Call Tedge
tedge config list 0.112 s Call Tedge Config List
tedge config list --all 0.146 s Call Tedge Config List
set/unset device.type 0.587 s Call Tedge Config List
set/unset device.key.path 0.728 s Call Tedge Config List
set/unset device.cert.path 0.928 s Call Tedge Config List
set/unset c8y.root.cert.path 0.664 s Call Tedge Config List
set/unset c8y.smartrest.templates 0.632 s Call Tedge Config List
set/unset az.root.cert.path 0.423 s Call Tedge Config List
set/unset az.mapper.timestamp 0.421 s Call Tedge Config List
set/unset mqtt.bind_address 0.654 s Call Tedge Config List
set/unset mqtt.port 0.583 s Call Tedge Config List
set/unset tmp.path 0.726 s Call Tedge Config List
set/unset logs.path 0.433 s Call Tedge Config List
set/unset run.path 0.357 s Call Tedge Config List
Get Put Delete 4.355 s Http File Transfer Api
Set keys should return value on stdout 0.334 s Tedge Config Get
Unset keys should not return anything on stdout and warnings on stderr 0.479 s Tedge Config Get
Invalid keys should not return anything on stdout and warnings on stderr 0.443 s Tedge Config Get

@reubenmiller reubenmiller merged commit 1b30760 into thin-edge:main Mar 3, 2023
gligorisaev pushed a commit to gligorisaev/thin-edge.io that referenced this pull request Mar 9, 2023
* Output tedge config control messages to stderr

Closes thin-edge#1721

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>

* Print logs from tedge cli to stderr

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>

* Add tests

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>

---------

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
@Bravo555 Bravo555 deleted the tedge-config-stderr branch June 12, 2023 15:09
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.

None yet

3 participants