Skip to content

Commit 36b9830

Browse files
authored
Merge branch 'main' into feat/test-collections
2 parents bcebf6d + 8bc1f13 commit 36b9830

10 files changed

Lines changed: 20 additions & 11 deletions

File tree

.github/actions/test_ruby_gem_uploads/action.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ inputs:
2424
platform:
2525
description: The platform that the gem was built for
2626
required: true
27+
test-collection-id:
28+
description: Optional 8 character alphanumeric ID for a test collection
29+
required: false
2730
knapsack-pro-test-suite-token-rspec:
2831
description: Optional Knapsack Pro test suite token for RSpec
2932
required: true

.github/workflows/release_ruby_gem.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ jobs:
132132
with:
133133
ruby-version: ${{ matrix.ruby-version }}
134134
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
135+
test-collection-id: T5yKSn9h
135136
platform: ${{ matrix.platform.name }}
136137
artifact-pattern: cross-gem-${{ matrix.platform.name }}
137138
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}

.github/workflows/ruby.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ jobs:
119119
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
120120
trunk-public-api-address: https://api.trunk-staging.io
121121
trunk-org-slug: trunk-staging-org
122+
test-collection-id: T5yKSn9h
122123
platform: x86_64-linux
123124
artifact-pattern: ""
124125
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}

.github/workflows/smoke_test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ jobs:
173173
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
174174
trunk-public-api-address: https://api.trunk-staging.io
175175
trunk-org-slug: trunk-staging-org
176+
test-collection-id: T5yKSn9h
176177
platform: x86_64-linux
177178
artifact-pattern: ""
178179
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
@@ -199,6 +200,7 @@ jobs:
199200
trunk-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
200201
trunk-public-api-address: https://api.trunk.io
201202
trunk-org-slug: trunk
203+
test-collection-id: BiBP2neA
202204
platform: x86_64-linux
203205
artifact-pattern: ""
204206
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}

.github/workflows/smoke_test_main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ jobs:
226226
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
227227
trunk-public-api-address: https://api.trunk-staging.io
228228
trunk-org-slug: trunk-staging-org
229+
test-collection-id: T5yKSn9h
229230
platform: x86_64-linux
230231
artifact-pattern: ""
231232
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
@@ -252,6 +253,7 @@ jobs:
252253
trunk-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
253254
trunk-public-api-address: https://api.trunk.io
254255
trunk-org-slug: trunk
256+
test-collection-id: BiBP2neA
255257
platform: x86_64-linux
256258
artifact-pattern: ""
257259
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}

cli/src/upload_command.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ pub struct UploadArgs {
7272
#[arg(long, env = constants::TRUNK_ORG_URL_SLUG_ENV, help = "Organization url slug.")]
7373
pub org_url_slug: String,
7474
#[arg(
75-
long,
76-
env = constants::TRUNK_TEST_COLLECTION_SHORT_ID_ENV,
77-
help = "Optional test collection short ID to attach to the uploaded bundle for collection-aware ingestion.",
75+
long = "test-collection-id",
76+
env = constants::TRUNK_TEST_COLLECTION_ID_ENV,
77+
help = "Optional 8 character alphanumeric ID for a test collection.",
7878
required = false,
7979
num_args = 1
8080
)]

cli/tests/upload.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async fn upload_bundle() {
5959
let assert = command_builder
6060
.command()
6161
.env("GITHUB_EXTERNAL_ID", "test-external-id-123")
62-
.arg("--test-collection-short-id")
62+
.arg("--test-collection-id")
6363
.arg("tc_123")
6464
.assert()
6565
// should fail due to quarantine and succeed without quarantining
@@ -237,10 +237,7 @@ async fn upload_bundle() {
237237
assert_eq!(test_case_run.codeowners[1].name, "@user2");
238238

239239
let mut expected_command_args = command_builder.build_args();
240-
expected_command_args.extend([
241-
String::from("--test-collection-short-id"),
242-
String::from("tc_123"),
243-
]);
240+
expected_command_args.extend([String::from("--test-collection-id"), String::from("tc_123")]);
244241
assert!(
245242
debug_props.command_line.ends_with(
246243
&expected_command_args
@@ -530,7 +527,7 @@ async fn upload_bundle_without_canonical_test_collection_metadata_keeps_bundle_g
530527

531528
CommandBuilder::upload(temp_dir.path(), state.host.clone())
532529
.command()
533-
.arg("--test-collection-short-id")
530+
.arg("--test-collection-id")
534531
.arg("tc_123")
535532
.assert()
536533
.failure();

constants/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub const TRUNK_API_CLIENT_RETRY_COUNT_ENV: &str = "TRUNK_API_CLIENT_RETRY_COUNT
2929
pub const TRUNK_API_TOKEN_ENV: &str = "TRUNK_API_TOKEN";
3030
pub const TRUNK_PUBLIC_REPO_ID_ENV: &str = "TRUNK_PUBLIC_REPO_ID";
3131
pub const TRUNK_ORG_URL_SLUG_ENV: &str = "TRUNK_ORG_URL_SLUG";
32-
pub const TRUNK_TEST_COLLECTION_SHORT_ID_ENV: &str = "TRUNK_TEST_COLLECTION_SHORT_ID";
32+
pub const TRUNK_TEST_COLLECTION_ID_ENV: &str = "TRUNK_TEST_COLLECTION_ID";
3333
pub const TRUNK_REPO_ROOT_ENV: &str = "TRUNK_REPO_ROOT";
3434
pub const TRUNK_REPO_URL_ENV: &str = "TRUNK_REPO_URL";
3535
pub const TRUNK_REPO_HEAD_SHA_ENV: &str = "TRUNK_REPO_HEAD_SHA";
@@ -63,7 +63,7 @@ pub const TRUNK_ENVS_TO_CAPTURE: &[&str] = &[
6363
TRUNK_API_CLIENT_RETRY_COUNT_ENV,
6464
TRUNK_PUBLIC_REPO_ID_ENV,
6565
TRUNK_ORG_URL_SLUG_ENV,
66-
TRUNK_TEST_COLLECTION_SHORT_ID_ENV,
66+
TRUNK_TEST_COLLECTION_ID_ENV,
6767
TRUNK_REPO_ROOT_ENV,
6868
TRUNK_REPO_URL_ENV,
6969
TRUNK_REPO_HEAD_SHA_ENV,

rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#
2121
# Optional environment variables for configuration:
2222
# TRUNK_CODEOWNERS_PATH - Path to CODEOWNERS file
23+
# TRUNK_TEST_COLLECTION_ID - Optional 8 character alphanumeric ID for a test collection
2324
# TRUNK_VARIANT - Variant name for test results (e.g., 'linux', 'pr-123')
2425
# TRUNK_DISABLE_QUARANTINING - Set to 'true' to disable quarantining
2526
# TRUNK_ALLOW_EMPTY_TEST_RESULTS - Set to 'true' to allow empty results

test_report/src/report.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,8 @@ impl MutTestReport {
696696
upload_args.pr_number = env::var(constants::TRUNK_PR_NUMBER_ENV)
697697
.ok()
698698
.and_then(|v| v.parse::<usize>().ok());
699+
upload_args.test_collection_short_id =
700+
env::var(constants::TRUNK_TEST_COLLECTION_ID_ENV).ok();
699701
let debug_props = BundleMetaDebugProps {
700702
command_line: self.0.borrow().command.clone(),
701703
trunk_envs: HashMap::new(),

0 commit comments

Comments
 (0)