Skip to content

Commit

Permalink
Add system test for the fix
Browse files Browse the repository at this point in the history
Signed-off-by: Rina Fujino <rina.fujino.23@gmail.com>
  • Loading branch information
rina23q committed Aug 16, 2024
1 parent 66a1bab commit 8eed947
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/core/plugin_sm/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use tedge_api::DEFAULT;
use tedge_config::SudoCommandBuilder;
use tokio::io::AsyncWriteExt;
use tracing::error;
use tracing::info;

#[async_trait]
pub trait Plugin {
Expand Down Expand Up @@ -134,7 +135,8 @@ pub trait Plugin {
// Execute the updates
if failed_updates.is_empty() {
let outcome = self.update_list(&updates, command_log.as_deref_mut()).await;
if let Err(SoftwareError::UpdateListNotSupported(_)) = outcome {
if let Err(SoftwareError::UpdateListNotSupported(name)) = outcome {
info!("{}", SoftwareError::UpdateListNotSupported(name));
for update in updates.iter() {
if let Err(error) = self
.apply(update, command_log.as_deref_mut(), download_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ case "$1" in
done
exit 0
;;
install)
exit 0
;;
remove)
exit 0
;;
prepare)
exit 0
;;
update-list)
exit 0
# means update-list is unsupported by this plugin
exit 1
;;
finalize)
exit 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Resource ../../../resources/common.resource
Library ThinEdgeIO
Library Cumulocity
Library Collections

Test Setup Custom Setup
Test Teardown Custom Teardown
Expand Down Expand Up @@ -119,6 +120,16 @@ Filter packages list using both patterns
... {"name": "dummy2-1500", "version": "1.0.0", "softwareType": "dummy2"}
Length Should Be ${software} 1504

Software updates download software packages only once #3062
Connect Mapper c8y
Device Should Exist ${DEVICE_SN}
${file_url}= Cumulocity.Create Inventory Binary sm-plugin-test-file software1 contents=Testing a thing
${OPERATION}= Install Software dummy-software,1.0.0::dummy1,${file_url}
${OPERATION}= Operation Should Be SUCCESSFUL ${OPERATION} timeout=60
${op_id}= Get From Dictionary ${OPERATION} id
${count}= Execute Command grep Downloading /var/log/tedge/agent/workflow-software_update-c8y-mapper-${op_id}.log -c
Should Be Equal As Numbers ${count} 1

*** Keywords ***
Custom Setup
${DEVICE_SN}= Setup skip_bootstrap=${True}
Expand Down

0 comments on commit 8eed947

Please sign in to comment.