mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-18 09:41:56 +00:00
test(github-sync): align live team and scanner fixtures
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
e9884f677c
commit
cab3cde256
2 changed files with 14 additions and 7 deletions
|
|
@ -376,10 +376,11 @@ func TestInteropProcessRepositoryPublicMultiSkill(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if task == nil || task.PlatformControlVersion == nil || task.TaskID != os.Getenv("SKILLHUB_INTEROP_TASK_ID") ||
|
||||
// Java creates a TEAM source here; platform pause epochs apply only to @github.
|
||||
if task == nil || task.PlatformControlVersion != nil || task.TaskID != os.Getenv("SKILLHUB_INTEROP_TASK_ID") ||
|
||||
task.Repository == nil || task.Repository.RepositoryID != repositoryID ||
|
||||
task.Repository.FixedCommitSHA != commitSHA || task.Mode != "FULL" {
|
||||
t.Fatal("Java did not lease the expected fixed-commit repository task")
|
||||
t.Fatal("Java did not lease the expected TEAM repository task without platform control")
|
||||
}
|
||||
if allTree && (task.MaxFilesPerPackage != 100 || task.MaxPackageBytes != 100<<20 ||
|
||||
task.MaxUploadBytes != 100<<20) {
|
||||
|
|
|
|||
|
|
@ -1755,6 +1755,8 @@ class GithubSyncHttpIngestionInteropTest {
|
|||
@Test
|
||||
@EnabledIfEnvironmentVariable(named = "SKILLHUB_GITHUB_SYNC_LIVE_INTERRUPT_INTEROP", matches = "1")
|
||||
void repositoryWorkerResumesAfterSigtermBetweenReceiptAndAcknowledgement() throws Exception {
|
||||
long repositoryId = "1".equals(System.getenv("SKILLHUB_GITHUB_SYNC_LIVE_WORKER_REAL_TREE"))
|
||||
? 1103643573L : 987654350L;
|
||||
String namespaceSlug = "interop-interrupted-" + UUID.randomUUID().toString().substring(0, 8);
|
||||
long namespaceId = jdbc.queryForObject("""
|
||||
INSERT INTO namespace (slug, display_name, type)
|
||||
|
|
@ -1769,10 +1771,10 @@ class GithubSyncHttpIngestionInteropTest {
|
|||
INSERT INTO github_source_binding
|
||||
(namespace_id, repository_id, owner_login, repository_name, visibility,
|
||||
next_check_at)
|
||||
VALUES (?, 987654350, 'openai', 'skills', 'NAMESPACE_ONLY',
|
||||
VALUES (?, ?, 'openai', 'skills', 'NAMESPACE_ONLY',
|
||||
CURRENT_TIMESTAMP + INTERVAL '1 day') RETURNING id
|
||||
""", Long.class, namespaceId);
|
||||
UUID taskId = createRepositoryTask(namespaceId, sourceId, 987654350L);
|
||||
""", Long.class, namespaceId, repositoryId);
|
||||
UUID taskId = createRepositoryTask(namespaceId, sourceId, repositoryId);
|
||||
Path tempRoot = Files.createTempDirectory("skillhub-github-interrupted-");
|
||||
try {
|
||||
ProcessBuilder builder = publicMultiSkillWorkerBuilder(taskId, false);
|
||||
|
|
@ -3070,7 +3072,10 @@ class GithubSyncHttpIngestionInteropTest {
|
|||
}
|
||||
|
||||
private void awaitVersionStatus(Long versionId, String expected) throws InterruptedException {
|
||||
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
|
||||
// The opt-in external scanner does real analysis and may queue requests;
|
||||
// the local HTTP fixture should still finish within the short budget.
|
||||
long timeoutSeconds = scanner == null ? 180 : 15;
|
||||
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(timeoutSeconds);
|
||||
String actual;
|
||||
do {
|
||||
actual = jdbc.queryForObject("SELECT status FROM skill_version WHERE id = ?",
|
||||
|
|
@ -3080,7 +3085,8 @@ class GithubSyncHttpIngestionInteropTest {
|
|||
}
|
||||
Thread.sleep(100);
|
||||
} while (System.nanoTime() < deadline);
|
||||
assertThat(actual).isEqualTo(expected);
|
||||
assertThat(actual).as("version %s status after %s seconds", versionId, timeoutSeconds)
|
||||
.isEqualTo(expected);
|
||||
}
|
||||
|
||||
private String baseUrl() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue