feat: 收口模板升级与阶段七持续回归
This commit is contained in:
1 parent
ec16fff70e
commit
71c528de34
29 files changed
+1962
-304
No files matched your search
@@ -131,3 +131,67 @@ test("模板目录客户端发送分页并支持版本发布和审计", async ()
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test("模板升级和回滚提交预览版本、checksum 与逐项保留确认", async () => {
|
||||
const calls: Array<{ url: string; method?: string; body?: string }> = [];
|
||||
const client = new ApiClient({
|
||||
baseUrl: "http://api.test",
|
||||
token: "brand-token",
|
||||
fetcher: async (url, init) => {
|
||||
calls.push({ url, method: init?.method, body: init?.body });
|
||||
return response({ installation: { templateVersion: "2.0.0" } });
|
||||
},
|
||||
});
|
||||
await client.upgradeAdminTemplate({
|
||||
templatePackageVersionId: "target-version",
|
||||
expectedContentChecksum: "target-checksum",
|
||||
expectedCurrentVersion: "1.0.0",
|
||||
expectedCurrentPackageVersionId: "source-version",
|
||||
confirm: true,
|
||||
preservedBindings: [{ key: "founder", binding: "brand.config.founder", action: "preserve" }],
|
||||
});
|
||||
await client.rollbackAdminTemplate({ expectedCurrentVersion: "2.0.0", confirm: true });
|
||||
assert.deepEqual(calls, [
|
||||
{
|
||||
url: "http://api.test/admin/workspace/template/upgrade",
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
templatePackageVersionId: "target-version",
|
||||
expectedContentChecksum: "target-checksum",
|
||||
expectedCurrentVersion: "1.0.0",
|
||||
expectedCurrentPackageVersionId: "source-version",
|
||||
confirm: true,
|
||||
preservedBindings: [
|
||||
{ key: "founder", binding: "brand.config.founder", action: "preserve" },
|
||||
],
|
||||
}),
|
||||
},
|
||||
{
|
||||
url: "http://api.test/admin/workspace/template/rollback",
|
||||
method: "POST",
|
||||
body: JSON.stringify({ expectedCurrentVersion: "2.0.0", confirm: true }),
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test("模板运营失败指标客户端发送查询窗口", async () => {
|
||||
const calls: Array<{ url: string; method?: string }> = [];
|
||||
const client = new ApiClient({
|
||||
baseUrl: "http://api.test",
|
||||
token: "template-admin-token",
|
||||
fetcher: async (url, init) => {
|
||||
calls.push({ url, method: init?.method });
|
||||
return response({
|
||||
since: "2026-10-01",
|
||||
until: "2026-10-17",
|
||||
days: 14,
|
||||
backfilled: false,
|
||||
failures: [],
|
||||
});
|
||||
},
|
||||
});
|
||||
await client.getAdminTemplateOperationFailures({ days: 14 });
|
||||
assert.deepEqual(calls, [
|
||||
{ url: "http://api.test/admin/template-operations/failures?days=14", method: "GET" },
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user