summaryrefslogtreecommitdiffstats
path: root/tedge_config
diff options
context:
space:
mode:
authorPradeepKiruvale <PRADEEPKIRUVALE@gmail.com>2021-07-01 12:38:31 +0530
committerGitHub <noreply@github.com>2021-07-01 12:38:31 +0530
commit7ab3f046dbd7ba222ee5bfa72c8a20e8330b673a (patch)
tree10f5ab7d6e9b826b2d9b6378c4ac768100c4af62 /tedge_config
parentd958ca669a7d894170cfc66b932786bb62c90686 (diff)
[CIT-417] Address mqtt port change issues (#303)
* [CIT-417] update mqtt port * Fix the check connection functions * [CIT-417] update mqtt port * [CIT-417] Add system tests * [CIT-417] fix system test * [CIT-417] split the tests * [CIT-417] address review comment * [CIT-417] addressed review comments * fix mqtt port unset test * simplify the test * [CIT-417] test collectd-mapper * [CIT-417] cleanup test environment properly * Fix * [CIT-417] remove redundant test Co-authored-by: Pradeep K J <Pradeep K J pradeekumar.kj@softwareag.com> Co-authored-by: Pradeep K J <pradeekumar.kj@softwareag.com>
Diffstat (limited to 'tedge_config')
-rw-r--r--tedge_config/src/tedge_config_repository.rs4
-rw-r--r--tedge_config/tests/test_tedge_config.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/tedge_config/src/tedge_config_repository.rs b/tedge_config/src/tedge_config_repository.rs
index 59df9a7a..26597189 100644
--- a/tedge_config/src/tedge_config_repository.rs
+++ b/tedge_config/src/tedge_config_repository.rs
@@ -13,7 +13,7 @@ pub struct TEdgeConfigRepository {
pub trait ConfigRepository<T> {
type Error;
fn load(&self) -> Result<T, Self::Error>;
- fn store(&self, config: T) -> Result<(), Self::Error>;
+ fn store(&self, config: &T) -> Result<(), Self::Error>;
}
impl ConfigRepository<TEdgeConfig> for TEdgeConfigRepository {
@@ -26,7 +26,7 @@ impl ConfigRepository<TEdgeConfig> for TEdgeConfigRepository {
}
// TODO: Explicitly set the file permissions in this function and file ownership!
- fn store(&self, config: TEdgeConfig) -> Result<(), TEdgeConfigError> {
+ fn store(&self, config: &TEdgeConfig) -> Result<(), TEdgeConfigError> {
let toml = toml::to_string_pretty(&config.data)?;
// Create `$HOME/.tedge` or `/etc/tedge` directory in case it does not exist yet
diff --git a/tedge_config/tests/test_tedge_config.rs b/tedge_config/tests/test_tedge_config.rs
index 016676c6..95ce4d26 100644
--- a/tedge_config/tests/test_tedge_config.rs
+++ b/tedge_config/tests/test_tedge_config.rs
@@ -138,7 +138,7 @@ port = 1883
config.unset(AzureRootCertPathSetting)?;
config.unset(AzureMapperTimestamp)?;
config.update(MqttPortSetting, updated_mqtt_port)?;
- config_repo.store(config)?;
+ config_repo.store(&config)?;
}
{
@@ -414,7 +414,7 @@ fn set_az_keys_from_old_version_config() -> Result<(), TEdgeConfigError> {
config.update(AzureUrlSetting, ConnectUrl::try_from(updated_azure_url)?)?;
config.unset(AzureRootCertPathSetting)?;
config.unset(AzureMapperTimestamp)?;
- config_repo.store(config)?;
+ config_repo.store(&config)?;
}
{