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,86 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestViewerLookupsBackend(t *testing.T) {
|
||||
for _, b := range []storeSQLBackend{storeSQLite, storePostgreSQL} {
|
||||
t.Run(fmt.Sprint(b), func(t *testing.T) {
|
||||
f := newPublicationBackend(t, b)
|
||||
s, ctx := f.s, context.Background()
|
||||
if active, err := s.ActiveDomainMember(ctx, f.domain, f.actor); err != nil || !active {
|
||||
t.Fatal(active, err)
|
||||
}
|
||||
if active, err := s.ActiveDomainMember(ctx, "missing", f.actor); err != nil || active {
|
||||
t.Fatal(active, err)
|
||||
}
|
||||
if _, err := s.CityZoneKind(ctx, f.domain, "missing"); !errors.Is(err, sql.ErrNoRows) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := s.EnsurePeriodicalSchema(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if ids, err := s.PeriodicalProjectionTargets(ctx, f.domain, "blog"); err != nil || len(ids) != 0 {
|
||||
t.Fatal(ids, err)
|
||||
}
|
||||
if paths, err := s.ObjectAliasPaths(ctx, f.domain, "missing"); err != nil || len(paths) != 0 {
|
||||
t.Fatal(paths, err)
|
||||
}
|
||||
id, err := s.CreatePageAtPathInDomain(f.domain, "/synthetic-alias")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
paths, err := s.ObjectAliasPaths(ctx, f.domain, id)
|
||||
if err != nil || len(paths) != 1 || paths[0] != "/synthetic-alias" {
|
||||
t.Fatal(paths, err)
|
||||
}
|
||||
if paths, err = s.ObjectAliasPaths(ctx, "other", id); err != nil || len(paths) != 0 {
|
||||
t.Fatal(paths, err)
|
||||
}
|
||||
domain, err := s.GetDomainByUUID(f.domain)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if campus, err := s.ConfigTargetCampus(ctx, true, domain.ID); err != nil || campus != domain.CampusUUID {
|
||||
t.Fatal(campus, err)
|
||||
}
|
||||
if _, err = s.ConfigTargetCampus(ctx, false, -1); !errors.Is(err, sql.ErrNoRows) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = s.SavePersonalAppearance(ctx, f.domain, f.actor, 0, `{"Glass":45}`); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = s.SavePersonalAppearance(ctx, f.domain, f.actor, 0, `{"Glass":10}`); !errors.Is(err, sql.ErrNoRows) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = s.SavePersonalAppearance(ctx, f.domain, f.actor, 1, `{"Glass":60}`); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
version, raw, err := s.PersonalAppearance(ctx, f.domain, f.actor)
|
||||
if err != nil || version != 2 || raw != `{"Glass":60}` {
|
||||
t.Fatal(version, raw, err)
|
||||
}
|
||||
if err = s.SavePersonalAppearance(ctx, "other", f.actor, 0, `{}`); !errors.Is(err, ErrAccessDenied) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err = s.DB.Exec(`UPDATE principals SET state='suspended' WHERE uuid=`+s.sqlParam(1), f.actor); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if active, err := s.ActiveDomainMember(ctx, f.domain, f.actor); err != nil || active {
|
||||
t.Fatal(active, err)
|
||||
}
|
||||
if err = s.SavePersonalAppearance(ctx, f.domain, f.actor, 2, `{}`); !errors.Is(err, ErrAccessDenied) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.ReadOnly = true
|
||||
if err = s.SavePersonalAppearance(ctx, f.domain, f.actor, 2, `{}`); !errors.Is(err, ErrReadOnly) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user