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

tedge-mapper-c8y sync with tedge-agent #2050

Merged

Conversation

PradeepKiruvale
Copy link
Contributor

Proposed changes

Problem:
When the tedge-mapper-c8y starts, it will publish the tedge-agent supported operation to c8y and also sends a software list request to tedge-agent. If the tedge-agent is not up, then the software list request will be lost.

Proposed solution:

  • Check the tedge-agent status (either up or down)
  • Create the c8y_SoftwareUpdate & c8y_Restart supported operations files
  • Send the software list request to tedge-agent

Added an integration test as well

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

#1201
#1731

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

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #2050 (445387e) into main (6ba6a42) will increase coverage by 0.0%.
The diff coverage is 70.9%.

❗ Current head 445387e differs from pull request most recent head ccdfa9b. Consider uploading reports for the commit ccdfa9b to get more accurate results

Additional details and impacted files
Impacted Files Coverage Δ
crates/extensions/c8y_mapper_ext/src/actor.rs 69.4% <ø> (+1.1%) ⬆️
crates/extensions/c8y_mapper_ext/src/error.rs 0.0% <ø> (ø)
crates/extensions/c8y_mapper_ext/src/converter.rs 78.7% <63.1%> (-0.4%) ⬇️
crates/extensions/c8y_mapper_ext/src/tests.rs 93.4% <83.3%> (-0.1%) ⬇️

... and 8 files with indirect coverage changes

Comment on lines 111 to 117
// Send the init messages
if !self.tedge_agent_status && check_tedge_agent_status(&message) {
self.tedge_agent_status = true;
self.create_tedge_agent_supported_ops().await?;
self.send_out_sw_list_request_to_agent().await?;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

As I had expressed earlier, I still feel that this code better belongs in the converter for the following reasons, which I couldn't convey better in the other PR:

  1. All the other MQTT messages are already handled there. So it'd be better to keep everything at one place so that it's easier to mange.
  2. Since there's already a process_health_status_message function in the converter, this block would have been a better fit there, than here.
  3. That converter already has code to handle the software list and stuff like that as well. So, you could reuse quite a lot of that directly from there than introducing newer functions like send_out_sw_list_request_to_agent here that calls self.converter.get_software_list_message() anyway.
  4. Not to corrupt the actor further with state fields like ops_dir and tedge_agent_status fields as these are just details. Even for the ops_dir, it could be read from the C8yMapperConfig that's already passed to CumulocityConverter::new().

So, I'd still strongly recommend that we keep the actor clean, just with the message routing logic and push all the message processing details into the converter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, moved the code into the converter.

const TEDGE_HEALTH_UP_PAYLOAD: &str = r#""status":"up""#;
const TEDGE_HEALTH_DOWN_PAYLOAD: &str = r#""status":"down""#;

pub fn check_tedge_agent_status(message: &Message) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

[Minor] Not sure if this logic really deserved a module of its own. Could have been just a function in the converter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved this also into converter

Comment on lines 11 to 12
payload.contains(TEDGE_HEALTH_UP_PAYLOAD)
|| payload.contains(TEDGE_HEALTH_DOWN_PAYLOAD)
Copy link
Contributor

Choose a reason for hiding this comment

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

If the point is to make sure that the payload parses well as well, why not just parse it using serde into a struct similar to HealthStatus as done in service_monitor.rs? This payload check is a bit fragile as even the addition of an extra space between the key and value would break it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -50,6 +51,8 @@ pub struct C8yMapperActor {
messages: SimpleMessageBox<C8yMapperInput, C8yMapperOutput>,
mqtt_publisher: LoggingSender<MqttMessage>,
timer_sender: LoggingSender<SyncStart>,
ops_dir: PathBuf,
tedge_agent_status: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that you added this flag to prevent the mapper from repeatedly sending the software list request to the agent every time its status changes. But, may be it's a good thing. What if the agent restarted with a new set of sm-plugins loaded. In that case, it might be better to send the software list request to the agent every time it says it's "up".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean send the software list request only when the status is up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, send the software list request every time we receive an up status. Then, we don't even need this flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But the plan was to send if tedge-agent is up at least once. i.e up/down any message on health topic.

@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request June 28, 2023 13:26 — with GitHub Actions Inactive
Comment on lines 1051 to 1052
pub pid: Option<u64>,
pub status: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why Option? A health status should definitely have both these fields, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These topics are open, anything can be published. So, to be safer, if there is no status in the health message then it will not fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah there is the possibility of anyone publishing anything on that topic. But, as the mapper, it should only parse the well-formed health status messages with a valid pid and status fields. Any other malformed messages should just be ignored, without crashing the mapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, right. I did make it String.

Agent gets the software list request once it comes up
Execute Command sudo systemctl stop tedge-agent
# wait till health status down
Should Have MQTT Messages tedge/health/tedge-agent
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this API behaviour changed recently, but earlier this was checking the MQTT message trace right from the point where the device started up and will check for a message with the given topic anywhere in that trace. But, here I believe you wanted to check if the health status was generated after the tedge-agent was shutdown. For that, you need to pass the date_from parameter as well. You need to pass the message_contains or message_pattern args as well to make sure that the status value is down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added timestamp to check the specific messages.

Comment on lines 41 to 45
Should Have MQTT Messages tedge/health/tedge-agent
# now there should be a new list request
Should Have MQTT Messages tedge/commands/req/software/list
# agent must process the list request and send response
Should Have MQTT Messages tedge/commands/res/software/list
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above, regarding the usage of date_from and message_contains parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored to add the timestamp and check for the specific message

@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
228 0 5 228 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 1.623 s C8Y Child Alarms Rpi
Normal case when the child device already exists 0.836 s C8Y Child Alarms Rpi
Reconciliation when the new alarm message arrives, restart the mapper 1.6360000000000001 s C8Y Child Alarms Rpi
Reconciliation when the alarm that is cleared 5.524 s C8Y Child Alarms Rpi
Prerequisite Parent 18.38 s Child Conf Mgmt Plugin
Prerequisite Child 0.355 s Child Conf Mgmt Plugin
Child device bootstrapping 16.498 s Child Conf Mgmt Plugin
Snapshot from device 61.37 s Child Conf Mgmt Plugin
Child device config update 62.737 s Child Conf Mgmt Plugin
Configuration types should be detected on file change (without restarting service) 52.495 s Inotify Crate
Check lock file existence in default folder 1.07 s Lock File
Check PID number in lock file 1.857 s Lock File
Check PID number in lock file after restarting the services 2.636 s Lock File
Check starting same service twice 1.363 s Lock File
Switch off lock file creation 4.509 s Lock File
Set configuration when file exists 10.746 s Configuration Operation
Set configuration when file does not exist 6.786 s Configuration Operation
Set configuration with broken url 5.901 s Configuration Operation
Get configuration 5.447 s Configuration Operation
Get non existent configuration file 5.578 s Configuration Operation
Get non existent configuration type 5.233 s Configuration Operation
Update configuration plugin config via cloud 5.921 s Configuration Operation
Modify configuration plugin config via local filesystem modify inplace 2.981 s Configuration Operation
Modify configuration plugin config via local filesystem overwrite 5.23 s Configuration Operation
Update configuration plugin config via local filesystem copy 5.536 s Configuration Operation
Update configuration plugin config via local filesystem move (different directory) 5.492 s Configuration Operation
Update configuration plugin config via local filesystem move (same directory) 5.036 s Configuration Operation
Update the custom operation dynamically 67.017 s Dynamically Reload Operation
Custom operation successful 141.966 s Custom Operation
Custom operation fails 200.193 s Custom Operation
Successful firmware operation 77.48 s Firmware Operation
Install with empty firmware name 58.594 s Firmware Operation
Prerequisite Parent 19.816 s Firmware Operation Child Device
Prerequisite Child 8.289 s Firmware Operation Child Device
Child device firmware update 6.552 s Firmware Operation Child Device
Child device firmware update with cache 6.798 s Firmware Operation Child Device
Firmware plugin supports restart via service manager #1932 5.229 s Firmware Operation Child Device Retry
Update Inventory data via inventory.json 0.995 s Inventory Update
Inventory includes the agent fragment with version information 1.335 s Inventory Update
Retrieve a JWT tokens 46.823 s Jwt Request
Mapper recovers and processes output of ongoing software update request 17.88 s Recover And Publish Software Update Message
Check running collectd 1.158 s Monitor Device Collectd
Is collectd publishing MQTT messages? 2.893 s Monitor Device Collectd
Check thin-edge monitoring 3.725 s Monitor Device Collectd
Check grouping of measurements 9.329 s Monitor Device Collectd
Main device registration 2.166 s Device Registration
Child device registration 2.509 s Device Registration
Supports restarting the device 75.781 s Restart Device
Update tedge version from previous using Cumulocity 126.931 s Tedge Self Update
Test if all c8y services are up 62.235 s Service Monitoring
Test if all c8y services are down 63.008 s Service Monitoring
Test if all c8y services are using configured service type 184.714 s Service Monitoring
Test if all c8y services using default service type when service type configured as empty 105.125 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker stop start 20.506 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker restart 23.258 s Service Monitoring
Check health status of child device service 19.478 s Service Monitoring
Successful shell command with output 3.549 s Shell Operation
Check Successful shell command with literal double quotes output 3.432 s Shell Operation
Execute multiline shell command 3.62 s Shell Operation
Failed shell command 3.565 s Shell Operation
Software list should be populated during startup 48.234 s Software
Install software via Cumulocity 68.362 s Software
Software list should only show currently installed software and not candidates 51.906 s Software
Create and publish the tedge agent supported operations on mapper restart 49.044 s Mapper-Publishing-Agent-Supported-Ops
Agent gets the software list request once it comes up 51.765 s Mapper-Publishing-Agent-Supported-Ops
Child devices support sending simple measurements 2.18 s Child Device Telemetry
Child devices support sending custom measurements 1.712 s Child Device Telemetry
Child devices support sending custom events 1.379 s Child Device Telemetry
Child devices support sending custom events overriding the type 1.292 s Child Device Telemetry
Child devices support sending custom alarms #1699 1.189 s Child Device Telemetry
Child devices support sending inventory data via c8y topic 1.238 s Child Device Telemetry
Child device supports sending custom child device measurements directly to c8y 1.912 s Child Device Telemetry
Check retained alarms 176.033 s Raise Alarms
Thin-edge devices support sending simple measurements 1.772 s Thin-Edge Device Telemetry
Thin-edge devices support sending simple measurements with custom type 1.835 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom measurements 1.7530000000000001 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom events 1.565 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom events overriding the type 1.954 s Thin-Edge Device Telemetry
Thin-edge devices support sending custom alarms #1699 1.517 s Thin-Edge Device Telemetry
Thin-edge device supports sending custom Thin-edge device measurements directly to c8y 1.479 s Thin-Edge Device Telemetry
Thin-edge device support sending inventory data via c8y topic 1.327 s Thin-Edge Device Telemetry
thin-edge components support a custom config-dir location via flags 27.864 s Config Dir
Validate updated data path used by tedge-agent 0.622 s Data Path Config
Validate updated data path used by c8y-firmware-plugin 11.092 s Data Path Config
Validate updated data path used by tedge-agent 0.549 s Log Path Config
Check existence of init directories 1.201 s Tedge Init
Tedge init and check creation of folders 1.181 s Tedge Init
Check ownership of the folders 1.183 s Tedge Init
Change user/group and check the change 1.708 s Tedge Init
Tedge init and check if default values are restored 1.3519999999999999 s Tedge Init
Install thin-edge via apt 61.231 s Install Apt
Install latest via script (from current branch) 33.563 s Install Tedge
Install specific version via script (from current branch) 24.506 s Install Tedge
Install latest tedge via script (from main branch) 26.466 s Install Tedge
Install then uninstall latest tedge via script (from main branch) 80.979 s Install Tedge
Support starting and stopping services 43.282 s Service-Control
Supports a reconnect 58.48 s Test-Commands
Supports disconnect then connect 44.702 s Test-Commands
Update unknown setting 47.249 s Test-Commands
Update known setting 41.979 s Test-Commands
It checks MQTT messages using a pattern 76.357 s Test-Mqtt
Stop c8y-configuration-plugin 0.19 s Health C8Y-Configuration-Plugin
Update the service file 0.164 s Health C8Y-Configuration-Plugin
Reload systemd files 0.495 s Health C8Y-Configuration-Plugin
Start c8y-configuration-plugin 0.188 s Health C8Y-Configuration-Plugin
Start watchdog service 10.135 s Health C8Y-Configuration-Plugin
Check PID of c8y-configuration-plugin 0.135 s Health C8Y-Configuration-Plugin
Kill the PID 0.468 s Health C8Y-Configuration-Plugin
Recheck PID of c8y-configuration-plugin 6.818 s Health C8Y-Configuration-Plugin
Compare PID change 0.001 s Health C8Y-Configuration-Plugin
Stop watchdog service 0.234 s Health C8Y-Configuration-Plugin
Remove entry from service file 0.181 s Health C8Y-Configuration-Plugin
Stop c8y-log-plugin 0.179 s Health C8Y-Log-Plugin
Update the service file 0.208 s Health C8Y-Log-Plugin
Reload systemd files 0.531 s Health C8Y-Log-Plugin
Start c8y-log-plugin 0.145 s Health C8Y-Log-Plugin
Start watchdog service 10.236 s Health C8Y-Log-Plugin
Check PID of c8y-log-plugin 0.12 s Health C8Y-Log-Plugin
Kill the PID 0.367 s Health C8Y-Log-Plugin
Recheck PID of c8y-log-plugin 6.651 s Health C8Y-Log-Plugin
Compare PID change 0.001 s Health C8Y-Log-Plugin
Stop watchdog service 0.366 s Health C8Y-Log-Plugin
Remove entry from service file 0.329 s Health C8Y-Log-Plugin
Stop tedge-mapper 0.158 s Health Tedge Mapper C8Y
Update the service file 0.234 s Health Tedge Mapper C8Y
Reload systemd files 0.398 s Health Tedge Mapper C8Y
Start tedge-mapper 0.255 s Health Tedge Mapper C8Y
Start watchdog service 10.328 s Health Tedge Mapper C8Y
Check PID of tedge-mapper 0.259 s Health Tedge Mapper C8Y
Kill the PID 0.583 s Health Tedge Mapper C8Y
Recheck PID of tedge-mapper 6.747 s Health Tedge Mapper C8Y
Compare PID change 0.001 s Health Tedge Mapper C8Y
Stop watchdog service 0.288 s Health Tedge Mapper C8Y
Remove entry from service file 0.356 s Health Tedge Mapper C8Y
Stop tedge-agent 0.133 s Health Tedge-Agent
Update the service file 0.117 s Health Tedge-Agent
Reload systemd files 0.445 s Health Tedge-Agent
Start tedge-agent 0.306 s Health Tedge-Agent
Start watchdog service 10.172 s Health Tedge-Agent
Check PID of tedge-mapper 0.185 s Health Tedge-Agent
Kill the PID 0.324 s Health Tedge-Agent
Recheck PID of tedge-agent 6.889 s Health Tedge-Agent
Compare PID change 0.005 s Health Tedge-Agent
Stop watchdog service 0.355 s Health Tedge-Agent
Remove entry from service file 0.294 s Health Tedge-Agent
Stop tedge-mapper-az 0.296 s Health Tedge-Mapper-Az
Update the service file 0.189 s Health Tedge-Mapper-Az
Reload systemd files 0.993 s Health Tedge-Mapper-Az
Start tedge-mapper-az 0.196 s Health Tedge-Mapper-Az
Start watchdog service 10.296 s Health Tedge-Mapper-Az
Check PID of tedge-mapper-az 0.12 s Health Tedge-Mapper-Az
Kill the PID 0.296 s Health Tedge-Mapper-Az
Recheck PID of tedge-agent 6.516 s Health Tedge-Mapper-Az
Compare PID change 0.003 s Health Tedge-Mapper-Az
Stop watchdog service 0.232 s Health Tedge-Mapper-Az
Remove entry from service file 0.161 s Health Tedge-Mapper-Az
Stop tedge-mapper-collectd 0.362 s Health Tedge-Mapper-Collectd
Update the service file 0.238 s Health Tedge-Mapper-Collectd
Reload systemd files 0.577 s Health Tedge-Mapper-Collectd
Start tedge-mapper-collectd 0.202 s Health Tedge-Mapper-Collectd
Start watchdog service 10.249 s Health Tedge-Mapper-Collectd
Check PID of tedge-mapper-collectd 0.157 s Health Tedge-Mapper-Collectd
Kill the PID 0.311 s Health Tedge-Mapper-Collectd
Recheck PID of tedge-mapper-collectd 6.474 s Health Tedge-Mapper-Collectd
Compare PID change 0.003 s Health Tedge-Mapper-Collectd
Stop watchdog service 0.206 s Health Tedge-Mapper-Collectd
Remove entry from service file 0.091 s Health Tedge-Mapper-Collectd
tedge-collectd-mapper health status 6.046 s Health Tedge-Mapper-Collectd
c8y-log-plugin health status 5.992 s MQTT health endpoints
c8y-configuration-plugin health status 5.933 s MQTT health endpoints
Publish on a local insecure broker 0.671 s Basic Pub Sub
Publish on a local secure broker 3.8449999999999998 s Basic Pub Sub
Publish on a local secure broker with client authentication 3.7439999999999998 s Basic Pub Sub
Check remote mqtt broker #1773 3.177 s Remote Mqtt Broker
Apply name filter 0.293 s Filter Packages List Output
Apply maintainer filter 0.358 s Filter Packages List Output
Apply both filters 0.272 s Filter Packages List Output
No filters 0.409 s Filter Packages List Output
Both filters but name filter as empty string 0.5 s Filter Packages List Output
Both filters but maintainer filter as empty string 0.306 s Filter Packages List Output
Both filters as empty string 0.34 s Filter Packages List Output
Wrong package name 0.483 s Improve Tedge Apt Plugin Error Messages
Wrong version 0.248 s Improve Tedge Apt Plugin Error Messages
Wrong type 0.937 s Improve Tedge Apt Plugin Error Messages
tedge_connect_test_positive 0.485 s Tedge Connect Test
tedge_connect_test_negative 1.784 s Tedge Connect Test
tedge_connect_test_sm_services 9.418 s Tedge Connect Test
tedge_disconnect_test_sm_services 1.328 s Tedge Connect Test
Install thin-edge.io 24.281 s Call Tedge
call tedge -V 0.167 s Call Tedge
call tedge -h 0.115 s Call Tedge
call tedge -h -V 0.092 s Call Tedge
call tedge help 0.148 s Call Tedge
tedge config list 0.139 s Call Tedge Config List
tedge config list --all 0.118 s Call Tedge Config List
set/unset device.type 0.769 s Call Tedge Config List
set/unset device.key_path 0.453 s Call Tedge Config List
set/unset device.cert_path 0.439 s Call Tedge Config List
set/unset c8y.root_cert_path 0.331 s Call Tedge Config List
set/unset c8y.smartrest.templates 0.429 s Call Tedge Config List
set/unset az.root_cert_path 0.303 s Call Tedge Config List
set/unset aws.url 0.39 s Call Tedge Config List
set/unset aws.root_cert_path 0.492 s Call Tedge Config List
set/unset aws.mapper.timestamp 0.474 s Call Tedge Config List
set/unset az.mapper.timestamp 0.278 s Call Tedge Config List
set/unset mqtt.bind.address 0.288 s Call Tedge Config List
set/unset mqtt.bind.port 0.32 s Call Tedge Config List
set/unset http.bind.port 0.291 s Call Tedge Config List
set/unset tmp.path 0.288 s Call Tedge Config List
set/unset logs.path 0.302 s Call Tedge Config List
set/unset run.path 0.302 s Call Tedge Config List
set/unset firmware.child.update.timeout 0.295 s Call Tedge Config List
set/unset c8y.url 0.289 s Call Tedge Config List
set/unset az.url 0.294 s Call Tedge Config List
set/unset mqtt.external.bind.port 0.316 s Call Tedge Config List
mqtt.external.bind.address 0.295 s Call Tedge Config List
mqtt.external.bind.interface 0.282 s Call Tedge Config List
set/unset mqtt.external.ca_path 0.291 s Call Tedge Config List
set/unset mqtt.external.cert_file 0.317 s Call Tedge Config List
set/unset mqtt.external.key_file 0.449 s Call Tedge Config List
set/unset software.plugin.default 0.354 s Call Tedge Config List
Get Put Delete 1.81 s Http File Transfer Api
Set keys should return value on stdout 0.11 s Tedge Config Get
Unset keys should not return anything on stdout and warnings on stderr 0.235 s Tedge Config Get
Invalid keys should not return anything on stdout and warnings on stderr 0.424 s Tedge Config Get
Set configuration via environment variables 1.017 s Tedge Config Get
Set unknown configuration via environment variables 0.121 s Tedge Config Get

Copy link
Member

@rina23q rina23q left a comment

Choose a reason for hiding this comment

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

Besides my comments, I really agree with Albin's comments (where I put 👍 )

# wait till list request is pushed out
Should Have MQTT Messages tedge/commands/req/software/list
# stop mapper and remove the supported operations
Execute Command sudo systemctl stop tedge-mapper-c8y
Copy link
Member

Choose a reason for hiding this comment

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

You can use Stop Service key instead of Execute Command. (Also for restart, start, ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, done.

Comment on lines 12 to 13
# wait till list request is pushed out
Should Have MQTT Messages tedge/commands/req/software/list
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need this step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored. I was thinking just to make sure the list command is issued upon starting tedge-mapper-c8y. Now its moved to the second test and not required here anymore. This one tests the creation of operation files and publishing of operations.

@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request July 3, 2023 01:07 — with GitHub Actions Inactive
ThinEdgeIO.start Service tedge-mapper-c8y
Should Have MQTT Messages tedge/health/tedge-mapper-c8y message_contains=up date_from=${timestamp}
# After receiving the health status `up` from tege-agent, the mapper creates supported operations and will publish to c8y
Should Have MQTT Messages tedge/health/tedge-agent message_contains=up
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Should Have MQTT Messages tedge/health/tedge-agent message_contains=up
Should Have MQTT Messages tedge/health/tedge-agent message_contains=up date_from=${timestamp}

Signed-off-by: Pradeep Kumar K J <pkj@softwareag.com>
@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request July 4, 2023 12:20 — with GitHub Actions Inactive
@PradeepKiruvale PradeepKiruvale merged commit eb35cb0 into thin-edge:main Jul 4, 2023
18 checks passed
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