Skip to content
Closed
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
74 changes: 22 additions & 52 deletions cli/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,7 @@ pub fn gather_initial_test_context(
quarantine_resolution_mode: QuarantineResolutionMode::Unspecified,
},
failed_tests: Vec::with_capacity(0),
variant: upload_args.variant.as_ref().map(|v| {
if v.len() > 64 {
tracing::warn!(
"Variant '{}' exceeds 64 character limit and will be truncated",
v
);
v[..64].to_string()
} else {
v.clone()
}
}),
variant: upload_args.variant.clone(),
internal_bundled_file: None,
};

Expand Down Expand Up @@ -1159,7 +1149,7 @@ mod tests {
use crate::upload_command::UploadArgs;

#[test]
fn test_variant_truncation() {
fn test_variant_is_not_truncated() {
let mut upload_args = UploadArgs::new(
"test-token".to_string(),
"test-org".to_string(),
Expand All @@ -1168,46 +1158,26 @@ mod tests {
true,
);

// Test case 1: Variant under 64 characters
upload_args.variant = Some("short-variant".to_string());
let context = gather_initial_test_context(
upload_args.clone(),
BundleMetaDebugProps {
command_line: "test".to_string(),
trunk_envs: HashMap::new(),
},
)
.unwrap();
assert_eq!(context.meta.variant, Some("short-variant".to_string()));

// Test case 2: Variant exactly 64 characters
let long_variant = "a".repeat(64);
upload_args.variant = Some(long_variant.clone());
let context = gather_initial_test_context(
upload_args.clone(),
BundleMetaDebugProps {
command_line: "test".to_string(),
trunk_envs: HashMap::new(),
},
)
.unwrap();
assert_eq!(context.meta.variant, Some(long_variant));

// Test case 3: Variant over 64 characters
let very_long_variant = "a".repeat(100);
upload_args.variant = Some(very_long_variant.clone());
let context = gather_initial_test_context(
upload_args,
BundleMetaDebugProps {
command_line: "test".to_string(),
trunk_envs: HashMap::new(),
},
)
.unwrap();
assert_eq!(
context.meta.variant,
Some(very_long_variant[..64].to_string())
);
// Evergreen build variant names are often longer than 64 characters, and non-ASCII names
// must not be split inside a character.
for variant in [
"short-variant".to_string(),
"a".repeat(64),
"enterprise-amazon-linux2023-arm64-all-feature-flags-extra-system-deps-sharded-clusters"
.to_string(),
"é".repeat(100),
] {
upload_args.variant = Some(variant.clone());
let context = gather_initial_test_context(
upload_args.clone(),
BundleMetaDebugProps {
command_line: "test".to_string(),
trunk_envs: HashMap::new(),
},
)
.unwrap();
assert_eq!(context.meta.variant, Some(variant));
}
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion cli/src/upload_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pub struct UploadArgs {
#[arg(
long,
env = constants::TRUNK_VARIANT_ENV,
help = "Variant name for the test results (e.g., 'linux', 'macos', 'pr'). Used to group test runs. Max 64 characters.",
help = "Variant name for the test results (e.g., 'linux', 'macos', 'pr'). Used to group test runs.",
required = false,
num_args = 1
)]
Expand Down
Loading