Skip to content

Commit

Permalink
Merge pull request #3101 from reubenmiller/fix-device-profile-init
Browse files Browse the repository at this point in the history
fix: create device_profile workflow before loading workflows from disk
  • Loading branch information
albinsuresh committed Sep 4, 2024
2 parents ac21982 + ab1a88f commit 323615c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
6 changes: 4 additions & 2 deletions crates/core/tedge_agent/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ impl Agent {
// Runtime
let mut runtime = Runtime::new();

// Load device profile manager before the workflow actor
// as it will create the device_profile workflow if it does not already exist
DeviceProfileManagerBuilder::try_new(&self.config.operations_dir)?;

// Operation workflows
let workflows = load_operation_workflows(&self.config.operations_dir).await?;
let mut script_runner: ServerActorBuilder<ScriptActor, Concurrent> = ScriptActor::builder();
Expand All @@ -252,8 +256,6 @@ impl Agent {
// Software update actor
let mut software_update_builder = SoftwareManagerBuilder::new(self.config.sw_update_config);

DeviceProfileManagerBuilder::try_new(&self.config.operations_dir)?;

// Converter actor
let mut converter_actor_builder = WorkflowActorBuilder::new(
self.config.operation_config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Test Teardown Get Logs
*** Test Cases ***

Full supported operations message has no duplicates
Should Have MQTT Messages c8y/s/us message_pattern=114,c8y_DownloadConfigFile,c8y_LogfileRequest,c8y_RemoteAccessConnect,c8y_Restart,c8y_SoftwareUpdate,c8y_UploadConfigFile minimum=1 maximum=1
Should Have MQTT Messages c8y/s/us message_pattern=114,c8y_DeviceProfile,c8y_DownloadConfigFile,c8y_LogfileRequest,c8y_RemoteAccessConnect,c8y_Restart,c8y_SoftwareUpdate,c8y_UploadConfigFile minimum=1 maximum=1

Create and publish the tedge agent supported operations on mapper restart
# stop mapper and remove the supported operations
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*** Settings ***
Resource ../../../resources/common.resource
Library ThinEdgeIO
Library Cumulocity

Test Tags theme:tedge_agent
Test Setup Custom Setup
Test Teardown Get Logs

*** Test Cases ***

Device profile is included in supported operations
Should Have MQTT Messages te/device/main///cmd/device_profile message_pattern=^{}$
Should Contain Supported Operations c8y_DeviceProfile


*** Keywords ***

Custom Setup
${DEVICE_SN}= Setup
Set Suite Variable $DEVICE_SN
Device Should Exist ${DEVICE_SN}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ Test Teardown Get Logs

*** Test Cases ***

Device profile is included in supported operations
${CAPABILITY_MESSAGE}= Execute Command timeout 1 tedge mqtt sub 'te/device/main///cmd/device_profile' strip=${True} ignore_exit_code=${True}
Should Be Equal ${CAPABILITY_MESSAGE} [te/device/main///cmd/device_profile] {}
Should Contain Supported Operations c8y_DeviceProfile


Send device profile operation from Cumulocity IoT
${config_url}= Create Inventory Binary tedge-configuration-plugin tedge-configuration-plugin file=${CURDIR}/tedge-configuration-plugin.toml

Expand Down

0 comments on commit 323615c

Please sign in to comment.