Skip to content

Commit 64e2526

Browse files
committed
refactor(grpc): Refactor grpc test
Reworked to make use of the mock exported in the astarte_message_hub_proto_mock crate. Removed controversioal template macro. Signed-off-by: Luca Arato <luca.arato@secomind.com>
1 parent 788e572 commit 64e2526

File tree

6 files changed

+694
-819
lines changed

6 files changed

+694
-819
lines changed

Cargo.lock

Lines changed: 55 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ uuid = { workspace = true, features = ["v4", "v5"] }
8080

8181
[dev-dependencies]
8282
astarte-device-sdk-derive = { workspace = true }
83+
astarte-message-hub-proto = { workspace = true }
84+
astarte-message-hub-proto-mock = { workspace = true }
8385
async-trait = { workspace = true }
8486
color-eyre = { workspace = true }
8587
env_logger = { workspace = true }
@@ -107,7 +109,8 @@ rustc-args = ["--cfg=docsrs"]
107109
[workspace.dependencies]
108110
astarte-device-sdk = { path = "./", version = "=0.9.3" }
109111
astarte-device-sdk-derive = { version = "=0.9.3", path = "./astarte-device-sdk-derive" }
110-
astarte-message-hub-proto = { git = "https://github.com/astarte-platform/astarte-message-hub-proto.git", rev = "370be08ff90236a25b15af6e27d5363739566f2f" }
112+
astarte-message-hub-proto = { git = "https://github.com/lucaato/astarte-message-hub-proto", rev = "ee9669303584f688f4c477669d6ce173b763564e" }
113+
astarte-message-hub-proto-mock = { git = "https://github.com/lucaato/astarte-message-hub-proto", rev = "ee9669303584f688f4c477669d6ce173b763564e" }
111114
async-trait = "0.1.67"
112115
base64 = "0.22.0"
113116
bson = "2.7.0"

astarte-device-sdk-derive/src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ impl TryFrom<&Variant> for IndividualMapping {
412412
.attrs
413413
.iter()
414414
.filter_map(|attr| parse_attribute_list::<MappingAttr>(attr, "mapping"))
415-
.last()
415+
.next_back()
416416
.ok_or(syn::Error::new(
417417
value.span(),
418418
r#"missing `#[mapping(endpoint = "...")] attribute for variant "#,

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ mod test {
108108
pub(crate) const E2E_DEVICE_DATASTREAM: &str = include_str!(
109109
"../e2e-test/interfaces/org.astarte-platform.rust.e2etest.DeviceDatastream.json"
110110
);
111+
pub(crate) const E2E_SERVER_DATASTREAM: &str = include_str!(
112+
"../e2e-test/interfaces/org.astarte-platform.rust.e2etest.ServerAggregate.json"
113+
);
111114
pub(crate) const E2E_DEVICE_AGGREGATE: &str = include_str!(
112115
"../e2e-test/interfaces/org.astarte-platform.rust.e2etest.DeviceAggregate.json"
113116
);

0 commit comments

Comments
 (0)