Skip to content

Commit

Permalink
fix existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trisch-me committed Jun 18, 2024
1 parent 811bf7b commit ca71137
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
15 changes: 15 additions & 0 deletions crates/weaver_forge/src/extensions/otel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "rec.b".into(),
Expand All @@ -680,6 +681,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "crec.a".into(),
Expand All @@ -694,6 +696,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "crec.b".into(),
Expand All @@ -708,6 +711,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "rec.c".into(),
Expand All @@ -722,6 +726,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "rec.d".into(),
Expand All @@ -736,6 +741,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "opt.a".into(),
Expand All @@ -750,6 +756,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "opt.b".into(),
Expand All @@ -764,6 +771,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "req.a".into(),
Expand All @@ -778,6 +786,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "req.b".into(),
Expand All @@ -792,6 +801,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
];
let json =
Expand Down Expand Up @@ -849,6 +859,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "attr2".to_owned(),
Expand All @@ -863,6 +874,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
Attribute {
name: "attr3".to_owned(),
Expand All @@ -877,6 +889,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
},
];

Expand Down Expand Up @@ -1163,6 +1176,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
};

add_tests_and_filters(&mut env);
Expand All @@ -1189,6 +1203,7 @@ mod tests {
deprecated: None,
tags: None,
value: None,
prefix: false,
};

add_tests_and_filters(&mut env);
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_resolved_schema/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use crate::value::Value;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::fmt::Display;
use std::ops::Not;
use weaver_semconv::attribute::{AttributeSpec, AttributeType, Examples, RequirementLevel};
use weaver_semconv::stability::Stability;
use std::ops::Not;

/// An attribute definition.
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash, JsonSchema)]
Expand Down
10 changes: 2 additions & 8 deletions crates/weaver_resolved_schema/src/lineage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,9 @@ impl AttributeLineage {
/// from the parent.
/// This method updates the lineage information for the tags field to
/// reflect the source of its value.
pub fn prefix(
&mut self,
local_value: &bool,
parent_value: &bool,
) -> bool {
pub fn prefix(&mut self, local_value: &bool, parent_value: &bool) -> bool {
if *local_value {
_ = self
.locally_overridden_fields
.insert("prefix".to_owned());
_ = self.locally_overridden_fields.insert("prefix".to_owned());
_ = self.inherited_fields.remove("prefix");
*local_value

Check warning on line 413 in crates/weaver_resolved_schema/src/lineage.rs

View check run for this annotation

Codecov / codecov/patch

crates/weaver_resolved_schema/src/lineage.rs#L411-L413

Added lines #L411 - L413 were not covered by tests
} else {
Expand Down
3 changes: 1 addition & 2 deletions crates/weaver_resolver/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl AttributeCatalog {

if *prefix {
// depending on the prefix we either create embedded attribute or normal reference
name = format!("{}.{}", group_prefix, r#ref.clone());
name = format!("{}.{}", group_prefix, r#ref);

Check warning on line 93 in crates/weaver_resolver/src/attribute.rs

View check run for this annotation

Codecov / codecov/patch

crates/weaver_resolver/src/attribute.rs#L93

Added line #L93 was not covered by tests
} else {
name = r#ref.clone();
}
Expand Down Expand Up @@ -142,7 +142,6 @@ impl AttributeCatalog {
);
}


Some(attr_ref)
} else {
None
Expand Down
1 change: 1 addition & 0 deletions crates/weaver_semconv/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ mod tests {
note: Some("note".to_owned()),
stability: Some(Stability::Stable),
deprecated: Some("deprecated".to_owned()),
prefix: false,
};
assert_eq!(attr.id(), "ref");
assert_eq!(attr.brief(), "brief");
Expand Down

0 comments on commit ca71137

Please sign in to comment.