Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangjinwu committed Sep 10, 2024
1 parent 4ad79ce commit a888d33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/connector/src/parser/protobuf/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ mod test {
}

fn pb_eq(a: &ProtobufAccess, field_name: &str, value: ScalarImpl) {
let dummy_type = DataType::Varchar;
let field = a.descriptor().get_field_by_name(field_name).unwrap();
let dummy_type = protobuf_type_mapping(&field, &mut vec![]).unwrap();
let d = a.access_owned(&[field_name], &dummy_type).unwrap().unwrap();
assert_eq!(d, value, "field: {} value: {:?}", field_name, d);
}
Expand Down
5 changes: 5 additions & 0 deletions src/connector/src/parser/unified/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ impl ProtobufAccess {
pub fn new(message: DynamicMessage) -> Self {
Self { message }
}

#[cfg(test)]
pub fn descriptor(&self) -> prost_reflect::MessageDescriptor {
self.message.descriptor()
}
}

impl Access for ProtobufAccess {
Expand Down

0 comments on commit a888d33

Please sign in to comment.