Skip to content
Merged
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
1 change: 1 addition & 0 deletions bundle/src/bundle_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct BundleMetaBaseProps {
pub version: String,
pub cli_version: String,
pub org: String,
pub test_collection_short_id: Option<String>,
pub repo: BundleRepo,
pub bundle_upload_id: String,
pub tags: Vec<CustomTag>,
Expand Down
1 change: 1 addition & 0 deletions bundle/src/bundler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ mod tests {
base_props: BundleMetaBaseProps {
version: META_VERSION.to_string(),
org: "org".to_string(),
test_collection_short_id: None,
repo: repo.clone(),
cli_version: "0.0.1".to_string(),
bundle_upload_id: "00".to_string(),
Expand Down
3 changes: 2 additions & 1 deletion cli/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ pub fn gather_initial_test_context(
bazel_bep_path,
test_reports,
org_url_slug,
test_collection_short_id,
repo_root,
repo_url,
repo_head_sha,
Expand Down Expand Up @@ -167,6 +168,7 @@ pub fn gather_initial_test_context(
base_props: BundleMetaBaseProps {
version: META_VERSION.to_string(),
org: org_url_slug,
test_collection_short_id,
repo,
cli_version: format!(
"cargo={} git={} rustc={}",
Expand Down Expand Up @@ -302,7 +304,6 @@ fn create_test_result(
) -> TestResult {
TestResult {
test_case_runs,
// trunk-ignore(clippy/deprecated)
uploader_metadata: Some(UploaderMetadata {
variant: variant.unwrap_or_default(),
..Default::default()
Expand Down
9 changes: 8 additions & 1 deletion cli/src/upload_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ pub struct UploadArgs {
pub test_reports: Vec<String>,
#[arg(long, env = constants::TRUNK_ORG_URL_SLUG_ENV, help = "Organization url slug.")]
pub org_url_slug: String,
#[arg(
long,
env = constants::TRUNK_TEST_COLLECTION_SHORT_ID_ENV,
help = "Optional test collection short ID to attach to the uploaded bundle for collection-aware ingestion.",
required = false,
num_args = 1
)]
pub test_collection_short_id: Option<String>,
#[arg(
long,
required = true,
Expand Down Expand Up @@ -488,7 +496,6 @@ pub async fn run_upload(
.quarantine_results
.clone();

// trunk-ignore(clippy/assigning_clones)
meta.failed_tests = quarantine_context.failures.clone();

let upload_started_at = chrono::Utc::now();
Expand Down
1 change: 1 addition & 0 deletions constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub const TRUNK_API_CLIENT_RETRY_COUNT_ENV: &str = "TRUNK_API_CLIENT_RETRY_COUNT
// Trunk CLI environment variable names for configuration overrides
pub const TRUNK_API_TOKEN_ENV: &str = "TRUNK_API_TOKEN";
pub const TRUNK_ORG_URL_SLUG_ENV: &str = "TRUNK_ORG_URL_SLUG";
pub const TRUNK_TEST_COLLECTION_SHORT_ID_ENV: &str = "TRUNK_TEST_COLLECTION_SHORT_ID";
pub const TRUNK_REPO_ROOT_ENV: &str = "TRUNK_REPO_ROOT";
pub const TRUNK_REPO_URL_ENV: &str = "TRUNK_REPO_URL";
pub const TRUNK_REPO_HEAD_SHA_ENV: &str = "TRUNK_REPO_HEAD_SHA";
Expand Down
9 changes: 5 additions & 4 deletions context-js/tests/parse_compressed_bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const generateBundleMeta = (): TestBundleMeta => ({
use_uncloned_repo: null,
upload_time_epoch: faker.number.int(),
tags: [],
test_collection_short_id: null,
test_command: faker.hacker.verb(),
});

Expand Down Expand Up @@ -287,9 +288,9 @@ describe("context-js", () => {
includeInternalBin: RUBY_INTERNAL_BIN,
});

await expect(
async () => await parse_meta_from_tarball(readableStream),
).rejects.toThrow("missing field `version`");
await expect(parse_meta_from_tarball(readableStream)).rejects.toThrowError(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not async anymore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it is async, we just didn't need a wrapping async fn

"missing field `version`",
);
});

it("decompresses and parses internal.bin", async () => {
Expand Down Expand Up @@ -410,7 +411,7 @@ describe("context-js", () => {

await expect(
parse_internal_bin_and_meta_from_tarball(readableStream),
).rejects.toThrow("No internal.bin file found in the tarball");
).rejects.toThrowError("No internal.bin file found in the tarball");
});

it("correctly gets and sets variant", async () => {
Expand Down
1 change: 1 addition & 0 deletions context-py/tests/test_parse_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def test_parse_and_dump_meta_roundtrip():
},
"schema": "V0_5_29",
"tags": [],
"test_collection_short_id": None,
"test_command": None,
"upload_time_epoch": 1721095230,
"use_uncloned_repo": None,
Expand Down
Loading