Skip to content

Commit 58523ef

Browse files
committed
feat: remove useless values from the metadata
1 parent 33c84ca commit 58523ef

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

src/run/ci_provider/github_actions/provider.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,13 @@ impl CIProvider for GitHubActionsProvider {
168168
.ok()
169169
.and_then(|v| serde_json::from_str::<Value>(&v).ok());
170170

171-
let run_part_id = if let (Some(Value::Object(matrix)), Some(Value::Object(strategy))) =
171+
let run_part_id = if let (Some(Value::Object(matrix)), Some(Value::Object(mut strategy))) =
172172
(gh_matrix, gh_strategy)
173173
{
174+
// remove useless values from the strategy
175+
strategy.remove("fail-fast");
176+
strategy.remove("max-parallel");
177+
174178
// The re-serialization is on purpose here. We want to serialize it as a single line.
175179
let matrix_str = serde_json::to_string(&matrix).expect("Unable to re-serialize matrix");
176180
let strategy_str =
@@ -415,7 +419,7 @@ mod tests {
415419
"job-index":1,
416420
"job-total":2,
417421
"max-parallel":2
418-
}"#,
422+
}"#,
419423
),
420424
),
421425
],
@@ -519,7 +523,7 @@ mod tests {
519523
r#"{
520524
"runner-version":"3.2.1",
521525
"numeric-value":123456789
522-
}"#,
526+
}"#,
523527
),
524528
),
525529
(
@@ -530,7 +534,7 @@ mod tests {
530534
"job-index":1,
531535
"job-total":2,
532536
"max-parallel":2
533-
}"#,
537+
}"#,
534538
),
535539
),
536540
],
@@ -554,13 +558,11 @@ mod tests {
554558

555559
assert_eq!(run_part.run_id, "123789");
556560
assert_eq!(run_part.job_name, "my_job");
557-
assert_eq!(run_part.run_part_id, "my_job-{\"runner-version\":\"3.2.1\",\"numeric-value\":123456789}-{\"fail-fast\":true,\"job-index\":1,\"job-total\":2,\"max-parallel\":2}");
561+
assert_eq!(run_part.run_part_id, "my_job-{\"runner-version\":\"3.2.1\",\"numeric-value\":123456789}-{\"job-total\":2,\"job-index\":1}");
558562
assert_json_snapshot!(run_part.metadata, @r#"
559563
{
560-
"fail-fast": true,
561564
"job-index": 1,
562565
"job-total": 2,
563-
"max-parallel": 2,
564566
"numeric-value": 123456789,
565567
"runner-version": "3.2.1"
566568
}
@@ -602,13 +604,11 @@ mod tests {
602604

603605
assert_eq!(run_part.run_id, "123789");
604606
assert_eq!(run_part.job_name, "my_job");
605-
assert_eq!(run_part.run_part_id, "my_job-{\"runner-version\":\"3.2.1\",\"numeric-value\":123456789}-{\"fail-fast\":true,\"job-index\":1,\"job-total\":2,\"max-parallel\":2}");
607+
assert_eq!(run_part.run_part_id, "my_job-{\"runner-version\":\"3.2.1\",\"numeric-value\":123456789}-{\"job-total\":2,\"job-index\":1}");
606608
assert_json_snapshot!(run_part.metadata, @r#"
607609
{
608-
"fail-fast": true,
609610
"job-index": 1,
610611
"job-total": 2,
611-
"max-parallel": 2,
612612
"numeric-value": 123456789,
613613
"runner-version": "3.2.1"
614614
}

src/run/ci_provider/github_actions/snapshots/codspeed__run__ci_provider__github_actions__provider__tests__matrix_job_provider_metadata-2.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ expression: run_part
44
---
55
{
66
"runId": "6957110437",
7-
"runPartId": "log-env-{\"runner-version\":\"3.2.1\",\"numeric-value\":123456789}-{\"fail-fast\":true,\"job-index\":1,\"job-total\":2,\"max-parallel\":2}",
7+
"runPartId": "log-env-{\"runner-version\":\"3.2.1\",\"numeric-value\":123456789}-{\"job-total\":2,\"job-index\":1}",
88
"jobName": "log-env",
99
"metadata": {
10-
"fail-fast": true,
1110
"job-index": 1,
1211
"job-total": 2,
13-
"max-parallel": 2,
1412
"numeric-value": 123456789,
1513
"runner-version": "3.2.1"
1614
}

0 commit comments

Comments
 (0)