Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ vector-common-macros = { path = "lib/vector-common-macros" }
vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] }
vector-vrl-category = { path = "lib/vector-vrl/category" }
vector-vrl-functions = { path = "lib/vector-vrl/functions", default-features = false }
vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "main", default-features = false, features = ["arbitrary", "cli", "test", "test_framework", "stdlib-base"] }
vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "generate-fixtures", default-features = false, features = ["arbitrary", "cli", "test", "test_framework", "stdlib-base"] }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep VRL dependency on stable upstream branch

Switching the workspace vrl dependency from main to the topic branch generate-fixtures makes every normal Vector build depend on an integration branch that is only needed for fixture generation. Because this is declared in the shared workspace dependency, all packages pull from that branch even when generate-fixtures is not enabled; if the branch is force-pushed or removed, dependency resolution breaks for CI and developer builds. Please keep the default dependency on a stable upstream ref (or pin an immutable rev) and scope fixture-only wiring behind the feature path instead.

Useful? React with 👍 / 👎.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex @thomasqueirozb will revert the above to main but after this vectordotdev/vrl#1711 is merged first. So you can ignore this finding.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood — thanks for the clarification.

Given your note that this will be reverted to main after vectordotdev/vrl#1711 merges, I’m treating that review finding on Cargo.toml (line 220) as resolved/no action needed for this PR and will not make any follow-up code changes for it.

View task →

mock_instant = { version = "0.6" }
serial_test = { version = "3.2" }
strum = { version = "0.28", features = ["derive"] }
Expand Down
31 changes: 13 additions & 18 deletions lib/codecs/tests/data/native_encoding/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 0 additions & 163 deletions lib/codecs/tests/data/native_encoding/vector_generate_fixtures.patch

This file was deleted.

This file was deleted.

7 changes: 7 additions & 0 deletions lib/vector-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ vector-config = { path = "../vector-config" }
vector-config-common = { path = "../vector-config-common" }
vrl.workspace = true
cfg-if.workspace = true
quickcheck = { workspace = true, optional = true }

[target.'cfg(target_os = "macos")'.dependencies]
security-framework = "3.5.1"
Expand Down Expand Up @@ -100,6 +101,12 @@ default = []
lua = ["dep:mlua", "dep:tokio-stream", "vrl/lua"]
vrl = []
test = ["vector-common/test", "proptest"]
generate-fixtures = ["vrl/generate-fixtures", "dep:quickcheck"]

[[bin]]
name = "generate-fixtures"
path = "src/bin/generate_fixtures.rs"
required-features = ["generate-fixtures"]

[[bench]]
name = "event"
Expand Down
38 changes: 38 additions & 0 deletions lib/vector-core/src/bin/generate_fixtures.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use std::{fs::File, io::Write, path::PathBuf};

use bytes::BytesMut;
use prost::Message;
use quickcheck::{Arbitrary as _, Gen};
use vector_core::event::{Event, EventArray, proto};

const SEED: u64 = 0;
const GEN_SIZE: usize = 128;

fn main() {
let fixture_dir =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../codecs/tests/data/native_encoding");
let json_dir = fixture_dir.join("json");
let proto_dir = fixture_dir.join("proto");
std::fs::create_dir_all(&json_dir).unwrap();
std::fs::create_dir_all(&proto_dir).unwrap();

let mut rng = Gen::from_size_and_seed(GEN_SIZE, SEED);
for n in 0..1024_usize {
let event = Event::arbitrary(&mut rng);

let mut json_out = File::create(json_dir.join(format!("{n:04}.json"))).unwrap();
serde_json::to_writer(&mut json_out, &event).unwrap();

let mut proto_out = File::create(proto_dir.join(format!("{n:04}.pb"))).unwrap();
let mut buf = BytesMut::new();
proto::EventArray::from(EventArray::from(event))
.encode(&mut buf)
.unwrap();
proto_out.write_all(&buf).unwrap();
}

#[allow(clippy::print_stdout)]
{
println!("Written 1024 fixtures to {}", fixture_dir.display());
}
}
Loading
Loading