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
@@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"pageswiki/internal/db"
|
||||
"pageswiki/internal/store"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestServeInstanceCancelled(t *testing.T) {
|
||||
t.Chdir("../..")
|
||||
t.Setenv("PAGESWIKI_INSTANCE_FQDN", "")
|
||||
root := t.TempDir()
|
||||
database, err := db.Open(root + "/pages.db")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer database.Close()
|
||||
if err = db.Migrate(database); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
st := store.NewWithDocumentRoot(database, root+"/documents")
|
||||
if err = st.EnsureConfigTable(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
st.BackgroundJobsDisabled = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
if err = serveInstance(ctx, root, st, "127.0.0.1:0"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = database.Ping(); err != nil {
|
||||
t.Fatal("server closed caller-owned DB", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManagedReconcilerCancellationBeforeFirstPass(t *testing.T) {
|
||||
t.Setenv("PAGESWIKI_INSTANCE_FQDN", "synthetic.invalid")
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
// No DB: cancellation must finish without attempting a repository read or
|
||||
// accessing an external campus. This test does not make a network request.
|
||||
done := startManagedCampusReconciler(ctx, t.TempDir(), &store.Store{})
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("reconciler did not stop")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user