Split up example tests into smaller batches and provide info on which example is failing (#6896)

* Give example info for failing std example tests

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Shard example tests into 10

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-14 05:50:54 +12:00
committed by GitHub
parent c3a8fc6d93
commit 33e83747f3
2 changed files with 26 additions and 24 deletions

View File

@ -1,5 +1,6 @@
use std::{collections::HashMap, fmt, str::FromStr};
use std::{fmt, str::FromStr};
use indexmap::IndexMap;
use regex::Regex;
use tower_lsp::lsp_types::{
CompletionItem, CompletionItemKind, CompletionItemLabelDetails, Documentation, InsertTextFormat, MarkupContent,
@ -449,7 +450,7 @@ pub struct ModData {
pub description: Option<String>,
pub module_name: String,
pub children: HashMap<String, DocData>,
pub children: IndexMap<String, DocData>,
}
impl ModData {
@ -465,7 +466,7 @@ impl ModData {
qual_name,
summary: None,
description: None,
children: HashMap::new(),
children: IndexMap::new(),
module_name,
}
}
@ -1236,23 +1237,21 @@ mod test {
.expect_mod()
};
#[allow(clippy::iter_over_hash_type)]
let mut count = 0;
for d in data.children.values() {
if let DocData::Mod(_) = d {
continue;
}
for (i, eg) in d.examples().enumerate() {
count += 1;
if count % SHARD_COUNT != SHARD {
continue;
}
let result = match crate::test_server::execute_and_snapshot(eg, None).await {
Err(crate::errors::ExecError::Kcl(e)) => {
errs.push(
miette::Report::new(crate::errors::Report {
error: e.error,
filename: format!("{}{i}", d.name()),
kcl_source: eg.to_string(),
})
.to_string(),
);
errs.push(format!("Error testing example {}{i}: {}", d.name(), e.error.message()));
continue;
}
Err(other_err) => panic!("{}", other_err),