Skip to content

Commit

Permalink
fix(codecs): fix 'ProtobufSerializerConfig' input type (vectordotdev#…
Browse files Browse the repository at this point in the history
…19264)

* fix(codecs): fix 'ProtobufSerializerConfig' input type

* changed to all()

* add simple config test

* restrict to Log
  • Loading branch information
pront authored and jszwedko committed Dec 21, 2023
1 parent ab7983a commit d2fea65
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/codecs/src/encoding/format/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl ProtobufSerializerConfig {

/// The data type of events that are accepted by `ProtobufSerializer`.
pub fn input_type(&self) -> DataType {
DataType::Log.and(DataType::Trace)
DataType::Log
}

/// The schema required by the serializer.
Expand Down Expand Up @@ -234,12 +234,27 @@ mod tests {
};
}

fn test_data_dir() -> PathBuf {
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("tests/data/protobuf")
}

fn test_message_descriptor(message_type: &str) -> MessageDescriptor {
let path = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap())
.join("tests/data/protobuf/test.desc");
get_message_descriptor(&path, &format!("test.{message_type}")).unwrap()
}

#[test]
fn test_config_input_type() {
let config = ProtobufSerializerConfig {
protobuf: ProtobufSerializerOptions {
desc_file: test_data_dir().join("test_protobuf.desc"),
message_type: "test_protobuf.Person".into(),
},
};
assert_eq!(config.input_type(), DataType::Log);
}

#[test]
fn test_encode_integers() {
let message = encode_message(
Expand Down

0 comments on commit d2fea65

Please sign in to comment.