-
Notifications
You must be signed in to change notification settings - Fork 2k
chore(codecs): replace native encoding fixture patch files with cfg-gated code #24971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thomasqueirozb
wants to merge
9
commits into
master
Choose a base branch
from
refactor/native-encoding-fixtures-cfg
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2a0aa3c
cfg-gate fixture generating code
thomasqueirozb 353d639
Use generate-fixtures vrl branch
thomasqueirozb ff76230
Move fixture generation into its own binary and use a set SEED
thomasqueirozb cce5b7e
Gate from_size_and_seed behind generate-fixtures
thomasqueirozb 8eaf3cc
Remove vrl_generate_fixtures.patch
thomasqueirozb 159d37a
Format
thomasqueirozb b5e78ff
Fix clippy warnings
thomasqueirozb 0901780
Fix markdown
thomasqueirozb c2294b0
Format again
thomasqueirozb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
163 changes: 0 additions & 163 deletions
163
lib/codecs/tests/data/native_encoding/vector_generate_fixtures.patch
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
lib/codecs/tests/data/native_encoding/vrl_generate_fixtures.patch
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching the workspace
vrldependency frommainto the topic branchgenerate-fixturesmakes 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 whengenerate-fixturesis 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 immutablerev) and scope fixture-only wiring behind the feature path instead.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
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
mainbut after this vectordotdev/vrl#1711 is merged first. So you can ignore this finding.There was a problem hiding this comment.
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
mainaftervectordotdev/vrl#1711merges, I’m treating that review finding onCargo.toml(line 220) as resolved/no action needed for this PR and will not make any follow-up code changes for it.View task →