summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crates/core/tedge_mapper/src/c8y/mapper.rs5
-rw-r--r--crates/core/tedge_mapper/src/c8y/tests.rs16
2 files changed, 19 insertions, 2 deletions
diff --git a/crates/core/tedge_mapper/src/c8y/mapper.rs b/crates/core/tedge_mapper/src/c8y/mapper.rs
index b5f9c275..6b5a8b3a 100644
--- a/crates/core/tedge_mapper/src/c8y/mapper.rs
+++ b/crates/core/tedge_mapper/src/c8y/mapper.rs
@@ -123,6 +123,7 @@ mod tests {
use mqtt_tests::{assert_received_all_expected, test_mqtt_broker};
use serde_json::json;
use std::time::Duration;
+ use tempfile::TempDir;
use test_case::test_case;
const TEST_TIMEOUT_SECS: Duration = Duration::from_secs(5);
@@ -180,13 +181,15 @@ mod tests {
let size_threshold = SizeThreshold(MQTT_MESSAGE_SIZE_THRESHOLD);
let operations = Operations::default();
+ let tmp_dir = TempDir::new().unwrap();
let converter = Box::new(
- CumulocityConverter::new(
+ CumulocityConverter::from_logs_path(
size_threshold,
DEVICE_NAME.into(),
DEVICE_TYPE.into(),
operations,
proxy,
+ tmp_dir.into_path(),
)
.unwrap(),
);
diff --git a/crates/core/tedge_mapper/src/c8y/tests.rs b/crates/core/tedge_mapper/src/c8y/tests.rs
index 03477298..2e8ccc0e 100644
--- a/crates/core/tedge_mapper/src/c8y/tests.rs
+++ b/crates/core/tedge_mapper/src/c8y/tests.rs
@@ -19,6 +19,7 @@ use mqtt_tests::test_mqtt_server::MqttProcessHandler;
use serde_json::json;
use serial_test::serial;
use std::{path::Path, time::Duration};
+use tempfile::TempDir;
use test_case::test_case;
use tokio::task::JoinHandle;
@@ -939,12 +940,25 @@ fn create_c8y_converter() -> CumulocityConverter<FakeC8YHttpProxy> {
let operations = Operations::default();
let http_proxy = FakeC8YHttpProxy {};
- CumulocityConverter::new(
+ let tmp_dir = TempDir::new().unwrap();
+ std::fs::create_dir_all(&format!(
+ "{}/tedge/agent/",
+ &tmp_dir.path().to_str().unwrap()
+ ))
+ .unwrap();
+ std::fs::File::create(&format!(
+ "{}/tedge/agent/software-list-2011-11-11T11:11:11Z.log",
+ &tmp_dir.path().to_str().unwrap()
+ ))
+ .unwrap();
+
+ CumulocityConverter::from_logs_path(
size_threshold,
device_name,
device_type,
operations,
http_proxy,
+ tmp_dir.into_path(),
)
.unwrap()
}