feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -9,6 +9,43 @@ import (
|
||||
"pageswiki/internal/db"
|
||||
)
|
||||
|
||||
func TestRevisionOutboxLookupFailureRollsBackSource(t *testing.T) {
|
||||
database, err := db.Open(t.TempDir() + "/outbox.db")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer database.Close()
|
||||
if err := db.Migrate(database); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := New(database)
|
||||
id, err := s.CreatePageAtPath("/guide")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.SaveRevision(id, "<p>original</p>", "first"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var before int
|
||||
if err := database.QueryRow(`SELECT count(*) FROM activity_outbox`).Scan(&before); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Keep object/revision storage valid but break only the event source lookup.
|
||||
if _, err := database.Exec(`ALTER TABLE paths RENAME COLUMN domain_uuid TO misplaced_domain_uuid`); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.SaveRevision(id, "<p>must roll back</p>", "second"); err == nil {
|
||||
t.Fatal("source lookup error was swallowed")
|
||||
}
|
||||
var revisions, events int
|
||||
if err := database.QueryRow(`SELECT count(*) FROM revisions WHERE object_uuid=?`, id).Scan(&revisions); err != nil || revisions != 1 {
|
||||
t.Fatal("revision committed without outbox", err, revisions)
|
||||
}
|
||||
if err := database.QueryRow(`SELECT count(*) FROM activity_outbox`).Scan(&events); err != nil || events != before {
|
||||
t.Fatal("partial outbox commit", err, events)
|
||||
}
|
||||
}
|
||||
|
||||
func TestActivityOutboxIdempotencyAndDomainSequence(t *testing.T) {
|
||||
db, err := sql.Open("sqlite", ":memory:")
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user