mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-11 22:51:04 +00:00
Merge remote-tracking branch 'origin/pr/844' into codex/validate/pr844-20260910
This commit is contained in:
commit
e86c28e3db
2 changed files with 50 additions and 0 deletions
|
|
@ -125,6 +125,12 @@
|
|||
"version": "1.0.0",
|
||||
"url": "https://bjcdn.openstorage.cn/open_res/xfyundoc/2026-07-31/0170ce8f-ad41-4819-bc50-9b572b1c6510/skillhub-builtin-skills/weather/1.0.0/181e36c0fd6ca5f6cdf224276dd12e0fd203f83456a988a6bcf15cc4f3c20dd6.zip",
|
||||
"sha256": "181e36c0fd6ca5f6cdf224276dd12e0fd203f83456a988a6bcf15cc4f3c20dd6"
|
||||
},
|
||||
{
|
||||
"slug": "zero-slop",
|
||||
"version": "2.10.2",
|
||||
"url": "https://bjcdn.openstorage.cn/open_res/xfyundoc/2026-09-10/2abb2bab-737c-479e-9c79-d153a140e30b/1789010150588/d84fea7cd1ee53f6582889c89877d9423c1a79b419553f4626e7ab6409da10b0.zip",
|
||||
"sha256": "d84fea7cd1ee53f6582889c89877d9423c1a79b419553f4626e7ab6409da10b0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,6 +251,50 @@ class BuiltinSkillInitializerTest {
|
|||
verify(skillPublishService, never()).publishFromEntries(any(), any(), any(), any(), any(), anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
void skipsPackageWhenDownloadFailsBeforeExtraction() throws Exception {
|
||||
givenManifestAndSystemPublisher();
|
||||
when(skillRepository.findByNamespaceIdAndSlug(1L, "skillhub-hello")).thenReturn(List.of());
|
||||
when(downloader.download(URI.create(ITEM.url()))).thenReturn(Optional.empty());
|
||||
|
||||
runInitializer();
|
||||
|
||||
verify(downloader).download(URI.create(ITEM.url()));
|
||||
verify(extractor, never()).extract(any());
|
||||
verify(skillPublishService, never()).publishFromEntries(any(), any(), any(), any(), any(), anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
void continuesWithLaterManifestItemWhenEarlierDownloadFails() throws Exception {
|
||||
ManifestItem laterItem = new ManifestItem(
|
||||
"next-skill",
|
||||
"1.0.0",
|
||||
"https://bjcdn.openstorage.cn/skills/next-skill.zip",
|
||||
PACKAGE_SHA256
|
||||
);
|
||||
List<PackageEntry> laterEntries = packageEntries("next-skill", "1.0.0", "same");
|
||||
givenManifestAndSystemPublisher(List.of(ITEM, laterItem));
|
||||
when(skillRepository.findByNamespaceIdAndSlug(1L, "skillhub-hello")).thenReturn(List.of());
|
||||
when(skillRepository.findByNamespaceIdAndSlug(1L, "next-skill")).thenReturn(List.of());
|
||||
when(downloader.download(URI.create(ITEM.url()))).thenReturn(Optional.empty());
|
||||
when(downloader.download(URI.create(laterItem.url()))).thenReturn(Optional.of(PACKAGE_BYTES));
|
||||
when(extractor.extract(PACKAGE_BYTES))
|
||||
.thenReturn(new SkillPackageArchiveExtractor.ExtractionResult(laterEntries, List.of()));
|
||||
|
||||
runInitializer();
|
||||
|
||||
verify(downloader).download(URI.create(ITEM.url()));
|
||||
verify(downloader).download(URI.create(laterItem.url()));
|
||||
verify(skillPublishService).publishFromEntries(
|
||||
eq(GLOBAL),
|
||||
eq(laterEntries),
|
||||
eq(PUBLISHER),
|
||||
eq(SkillVisibility.PUBLIC),
|
||||
eq(Set.of("SUPER_ADMIN")),
|
||||
eq(true)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void skipsWhenManifestSlugDoesNotMatchPackageMetadata() throws Exception {
|
||||
givenExtractedPackage(packageEntries("other-skill", "1.0.0", "same"));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue