test(library): 隔离数据契约与 r11 身份自然键矩阵
真实本机 PG/ES/MinIO:v071 目录镜像 10 模式、结构引用/游标 15 模式、 8 表×2 外部范围身份矩阵、13 模式自然键(含软删除与合法同 parent 正例)、 备份期间三注入、收尾故障与授权撤销两个真实治理 PG 用例。 需隔离服务的用例在 test-scope.json 显式声明:普通 CI 跳过不算通过。
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
|
||||
// 复用既有 fakeJobStore 提供 Store 的其余方法,只覆盖整库作业这几个。
|
||||
type fakeLibraryStore struct {
|
||||
sourceCandidate *governance.LibraryVersion
|
||||
fakeJobStore
|
||||
grant *governance.LibraryReleaseAuthorization
|
||||
versions []governance.LibraryVersion
|
||||
@@ -345,8 +346,11 @@ func TestLibrarySyncEnqueueCreatesJobOnlyWithGrant(t *testing.T) {
|
||||
store.enqueueEchoRequestedID = true
|
||||
config := Config{Store: store, ProductionReleaseRequestsEnabled: true, ProductionBackupRestoreVerified: true,
|
||||
LibraryProductionDatabaseURL: "postgres://prod.invalid/db", LibraryProductionInternalKB: "kb-int", LibraryCapacityBudgetBytes: 1 << 40}
|
||||
sourceID := bindSourceFixture(t, &config, store, &target)
|
||||
digest, _ = librarySyncParamsDigest("internal", target)
|
||||
body := `{"scope":"internal","target_snapshot_id":"` + target + `"}`
|
||||
|
||||
body = sourceRequestBody(t, body, sourceID)
|
||||
// 先没有授权
|
||||
recorder := httptest.NewRecorder()
|
||||
librarySyncEnqueue(recorder, httptest.NewRequest(http.MethodPost, "/api/v1/library/syncs", strings.NewReader(body)), config)
|
||||
@@ -393,6 +397,7 @@ func TestLibraryOverviewShowsLatestPrebackupWhenTargetDiffers(t *testing.T) {
|
||||
SnapshotID: sealed, CreatedAt: now.Add(-2 * time.Hour)},
|
||||
}}
|
||||
config := Config{Store: store, LibraryArchiveRoot: root, LibraryCapacityBudgetBytes: 1 << 30}
|
||||
bindSourceFixture(t, &config, store, &sealed)
|
||||
request := httptest.NewRequest(http.MethodGet, "/api/v1/library/overview?scope=internal", nil)
|
||||
recorder := httptest.NewRecorder()
|
||||
libraryOverviewHandler(recorder, request, config)
|
||||
@@ -510,7 +515,10 @@ func TestLibrarySyncEnqueueUsesExactCurrentVersionBeyondWindow(t *testing.T) {
|
||||
config := Config{Store: store, ProductionReleaseRequestsEnabled: true, ProductionBackupRestoreVerified: true,
|
||||
LibraryProductionDatabaseURL: "postgres://prod.invalid/db", LibraryProductionInternalKB: "kb-int",
|
||||
LibraryCapacityBudgetBytes: 1 << 40}
|
||||
sourceID := bindSourceFixture(t, &config, store, &target)
|
||||
digest, _ = librarySyncParamsDigest("internal", target)
|
||||
body := `{"scope":"internal","target_snapshot_id":"` + target + `"}`
|
||||
body = sourceRequestBody(t, body, sourceID)
|
||||
recorder := httptest.NewRecorder()
|
||||
librarySyncEnqueue(recorder, httptest.NewRequest(http.MethodPost, "/api/v1/library/syncs", strings.NewReader(body)), config)
|
||||
if recorder.Code != http.StatusAccepted {
|
||||
|
||||
Reference in New Issue
Block a user