production runtime and mock removal

This commit is contained in:
inman committed 2026-08-17 23:44:14 +08:00
1 parent 2ef3da7af5
commit 6480e503eb
55 files changed
+581 -540

No files matched your search

-22
View File
@@ -104,28 +104,6 @@ func TestImportGeneratedCompensatesBlobWhenCatalogFails(t *testing.T) {
}
}
func TestImportMockStoresAccessibleGeneratedAssetWithoutRemoteFetch(t *testing.T) {
cat := &memoryCatalog{}
blobs := &memoryBlobs{}
remote := &memoryRemote{}
ids := []string{"file-1", "asset-1"}
svc := NewService(cat, blobs, remote, func() time.Time { return time.Date(2026, 8, 13, 8, 0, 0, 0, time.UTC) }, func(string) string {
id := ids[0]
ids = ids[1:]
return id
})
created, err := svc.ImportMock(context.Background(), PlatformScope("owner-a"), ImportMockCommand{Capability: "image.generate", JobID: "job-1", Kind: KindImage, Tags: []string{"generated", "job:job-1"}})
if err != nil {
t.Fatal(err)
}
if created.ID != "asset-1" || created.StoragePath != "generated-results/2026-08-13/file-1-mock-image.svg" || created.URL != "https://app.test/generated-results/2026-08-13/file-1-mock-image.svg" || created.Metadata["mock"] != true || remote.called {
t.Fatalf("created = %#v remoteCalled=%v", created, remote.called)
}
if blobs.putContentType != "image/svg+xml" || !bytes.Contains(blobs.putBody, []byte("job-1")) {
t.Fatalf("stored contentType=%q body=%q", blobs.putContentType, blobs.putBody)
}
}
func TestDeleteLeavesCatalogWhenBlobDeletionFails(t *testing.T) {
cat := &memoryCatalog{assets: []Asset{{ID: "a", OwnerID: "o", StoragePath: "uploads/a"}}}
blobs := &memoryBlobs{deleteErr: errors.New("storage down")}