package conformance
import (
"bytes"
"context"
"crypto/ed25519"
"fmt"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
"time"
"github.com/danmestas/go-libfossil/internal/auth"
"github.com/danmestas/go-libfossil/internal/blob"
"github.com/danmestas/go-libfossil/internal/hash"
"github.com/danmestas/go-libfossil/internal/manifest"
"github.com/danmestas/go-libfossil/internal/repo"
"github.com/danmestas/go-libfossil/internal/shun"
"github.com/danmestas/go-libfossil/internal/sync"
"github.com/danmestas/go-libfossil/internal/xfer"
"github.com/danmestas/go-libfossil/simio"
)
type syncErasureCase struct {
Case
run func(t *testing.T) error
}
func syncErasureCases() []syncErasureCase {
return []syncErasureCase{
{Case{ID: "sync.9.3.1.row-and-sig", Req: "SP-9.3.1-1"}, syncErasureRowAndSig},
{Case{ID: "sync.9.3.1.key-pinning", Req: "SP-9.3.1-2"}, syncErasureKeyPinning},
{Case{ID: "sync.9.3.1.client-exchange", Req: "SP-9.3.1-3"}, syncErasureClientExchange},
{Case{ID: "sync.9.3.1.server-push-auth", Req: "SP-9.3.1-4"}, syncErasureServerPushAuth},
{Case{ID: "sync.9.3.1.fold-and-applied", Req: "SP-9.3.1-5"}, syncErasureFoldAndApplied},
}
}
func TestSyncErasures(t *testing.T) {
for _, c := range syncErasureCases() {
check(t, c.Case, func(t *testing.T) error { return c.run(t) })
}
}
func testErasureKey(seedByte byte) (ed25519.PublicKey, ed25519.PrivateKey) {
priv := ed25519.NewKeyFromSeed(bytes.Repeat([]byte{seedByte}, ed25519.SeedSize))
return priv.Public().(ed25519.PublicKey), priv
}
func testErasureRepo(t *testing.T) (*repo.Repo, string) {
t.Helper()
r, err := repo.Create(filepath.Join(t.TempDir(), "erasure.fossil"), "u", simio.CryptoRand{}, "")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { r.Close() })
pc, err := r.Config("project-code")
if err != nil || pc == "" {
t.Fatalf("project-code = %q, %v", pc, err)
}
return r, pc
}
func mustSignErasure(
t *testing.T, priv ed25519.PrivateKey, pc, uuid string,
mtime, notBefore int64, kind shun.ErasureKind, reason string,
) shun.Row {
t.Helper()
scom, err := shun.Sign(priv, pc, uuid, mtime, notBefore, kind, reason)
if err != nil {
t.Fatal(err)
}
return shun.Row{UUID: uuid, MTime: mtime, Comment: scom}
}
func formatShunCard(row shun.Row) *xfer.ConfigCard {
q := func(s string) string { return "'" + strings.ReplaceAll(s, "'", "''") + "'" }
payload := fmt.Sprintf("%d %s scom %s", row.MTime, q(row.UUID), q(row.Comment))
return &xfer.ConfigCard{Name: "/shun", Content: []byte(payload)}
}
// syncErasureRowAndSig verifies SP-9.3.1-1: /shun wire payload format and e1:
// Ed25519 signature over zit-erasure-v1 LF PROJECT-CODE LF UUID LF MTIME LF
// NOT-BEFORE LF KIND LF REASON.
func syncErasureRowAndSig(t *testing.T) error {
origin, pc := testErasureRepo(t)
pub, priv := testErasureKey(0x11)
const t0 int64 = 1900000000
if err := shun.SetPinnedKey(origin.DB(), pub, t0); err != nil {
return err
}
uuid := hash.SHA1([]byte("secret-blob"))
row := mustSignErasure(t, priv, pc, uuid, t0, t0+86400, shun.KindErase, "leak's note")
if _, err := shun.RecordSigned(origin.DB(), row); err != nil {
return err
}
resp, err := sync.HandleSync(context.Background(), origin, &xfer.Message{
Cards: []xfer.Card{&xfer.ReqConfigCard{Name: "/shun"}},
})
if err != nil {
return err
}
cfgs := smCardsOf[*xfer.ConfigCard](resp)
if len(cfgs) != 1 || cfgs[0].Name != "/shun" {
return expectf("reqconfig /shun returned %d cards: %v", len(cfgs), cfgs)
}
wantPayload := fmt.Sprintf("%d '%s' scom '%s'",
row.MTime, row.UUID, strings.ReplaceAll(row.Comment, "'", "''"))
if string(cfgs[0].Content) != wantPayload {
return expectf("/shun payload = %q, want %q", string(cfgs[0].Content), wantPayload)
}
if v, _ := shun.Judge(pub, pc, row); v != shun.VerdictVerified {
return expectf("signed row did not verify")
}
if v, _ := shun.Judge(pub, "other-project", row); v != shun.VerdictUnverified {
return expectf("signed row verified under wrong project code")
}
return nil
}
// syncErasureKeyPinning verifies SP-9.3.1-2: clone adopts erasure-key from
// scalar /config; pull/sync never changes it; a repo without erasure-key
// ignores signed rows.
func syncErasureKeyPinning(t *testing.T) error {
origin, pc := testErasureRepo(t)
pub1, _ := testErasureKey(0x21)
pub2, priv2 := testErasureKey(0x22)
const t0 int64 = 1900000000
if err := shun.SetPinnedKey(origin.DB(), pub1, t0); err != nil {
return err
}
if _, _, err := manifest.Checkin(origin, manifest.CheckinOpts{
Files: []manifest.File{{Name: "a.txt", Content: []byte("a\n")}},
Comment: "c1", User: "u", Time: time.Unix(t0, 0).UTC(),
}); err != nil {
return err
}
peer := &sync.MockTransport{Handler: func(req *xfer.Message) *xfer.Message {
resp, err := sync.HandleSync(context.Background(), origin, req)
if err != nil {
t.Fatal(err)
}
return resp
}}
cloned, _, err := sync.Clone(context.Background(),
filepath.Join(t.TempDir(), "clone.fossil"), peer, sync.CloneOpts{})
if err != nil {
return err
}
defer cloned.Close()
gotPub, ok, err := shun.PinnedKey(cloned.DB())
if err != nil || !ok || !bytes.Equal(gotPub, pub1) {
return expectf("clone pinned key = (%x, %v, %v), want %x", gotPub, ok, err, pub1)
}
// Ordinary pull receiving a new erasure-key MUST NOT change the pinned key.
spoofPeer := &sync.MockTransport{Handler: func(req *xfer.Message) *xfer.Message {
resp, err := sync.HandleSync(context.Background(), origin, req)
if err != nil {
t.Fatal(err)
}
resp.Cards = append(resp.Cards, &xfer.ConfigCard{
Name: "/config",
Content: []byte(fmt.Sprintf("%d 'erasure-key' value '%s'", t0+10, shun.FormatPublicKey(pub2))),
})
return resp
}}
if _, err := sync.Sync(context.Background(), cloned, spoofPeer, sync.SyncOpts{Pull: true}); err != nil {
return err
}
gotPub, ok, err = shun.PinnedKey(cloned.DB())
if err != nil || !ok || !bytes.Equal(gotPub, pub1) {
return expectf("pull altered erasure-key to %x, want %x", gotPub, pub1)
}
// A repo with no pinned key ignores received signed rows.
unpinned, _ := testErasureRepo(t)
if err := unpinned.SetConfig("project-code", pc); err != nil {
return err
}
u := hash.SHA1([]byte("ignored"))
row := mustSignErasure(t, priv2, pc, u, t0, t0, shun.KindErase, "no-key")
shunPeer := &sync.MockTransport{Handler: func(req *xfer.Message) *xfer.Message {
return &xfer.Message{Cards: []xfer.Card{formatShunCard(row)}}
}}
if _, err := sync.Sync(context.Background(), unpinned, shunPeer, sync.SyncOpts{Pull: true}); err != nil {
return err
}
if rows, err := shun.ListSigned(unpinned.DB()); err != nil || len(rows) != 0 {
return expectf("unpinned repo stored signed rows: %v, %v", rows, err)
}
return nil
}
// syncErasureClientExchange verifies SP-9.3.1-3: client sends reqconfig /shun
// on round 0 of pull/sync and push with rows, records only verified rows
// outside clone, and sends missing verified rows as trailing config /shun cards
// on the next round without resending rows the server already holds.
func syncErasureClientExchange(t *testing.T) error {
origin, pc := testErasureRepo(t)
pub, priv := testErasureKey(0x31)
_, badPriv := testErasureKey(0x32)
const t0 int64 = 1900000000
clock := simio.NewSimClockAt(time.Unix(t0+10, 0).UTC())
env := &simio.Env{Clock: clock, Rand: simio.CryptoRand{}, Storage: simio.OSStorage{}}
if err := shun.SetPinnedKey(origin.DB(), pub, t0); err != nil {
return err
}
if err := auth.CreateUser(origin.DB(), pc, "writer", "pw", "i"); err != nil {
return err
}
if _, _, err := manifest.Checkin(origin, manifest.CheckinOpts{
Files: []manifest.File{{Name: "a.txt", Content: []byte("a\n")}},
Comment: "c1", User: "u", Time: time.Unix(t0, 0).UTC(),
}); err != nil {
return err
}
// Shared verified row already on origin + an unverified row from another key.
sharedUUID := hash.SHA1([]byte("shared"))
sharedRow := mustSignErasure(t, priv, pc, sharedUUID, t0, t0+86400, shun.KindErase, "shared")
if _, err := shun.RecordSigned(origin.DB(), sharedRow); err != nil {
return err
}
badRow := mustSignErasure(t, badPriv, pc, hash.SHA1([]byte("bad")), t0, t0, shun.KindErase, "bad")
if _, err := shun.RecordSigned(origin.DB(), badRow); err != nil {
return err
}
if err := shun.Add(origin.DB(), hash.SHA1([]byte("plain")), "plain-shun"); err != nil {
return err
}
peer := &scSyncPeer{r: origin, opts: sync.HandleOpts{Clock: clock}}
client, _, err := sync.Clone(context.Background(),
filepath.Join(t.TempDir(), "client.fossil"), peer, sync.CloneOpts{Env: env})
if err != nil {
return err
}
defer client.Close()
// Add a new local verified erasure on client and also a local commit to push.
newUUID := hash.SHA1([]byte("client-erased"))
newRow := mustSignErasure(t, priv, pc, newUUID, t0+5, t0+86400, shun.KindErase, "new")
if _, err := shun.RecordSigned(client.DB(), newRow); err != nil {
return err
}
peer.requests = nil
res, err := sync.Sync(context.Background(), client, peer, sync.SyncOpts{
Push: true, Pull: true, User: "writer", Password: "pw", Env: env,
})
if err != nil || len(res.Errors) != 0 {
return expectf("sync failed: err=%v errors=%v", err, res.Errors)
}
seenReqs := peer.requests
if len(seenReqs) < 2 {
return expectf("expected at least 2 rounds (reqconfig /shun then push), got %d", len(seenReqs))
}
// Round 0 must carry reqconfig /shun.
hasReqShun := false
for _, rc := range smCardsOf[*xfer.ReqConfigCard](seenReqs[0]) {
if rc.Name == "/shun" {
hasReqShun = true
}
}
if !hasReqShun {
return expectf("round 0 omitted reqconfig /shun")
}
// Round 1 must push ONLY newRow (not sharedRow), and AFTER every non-comment card.
var pushedCfgs []*xfer.ConfigCard
seenConfig := false
for _, card := range seenReqs[1].Cards {
switch c := card.(type) {
case *xfer.ConfigCard:
if c.Name == "/shun" {
pushedCfgs = append(pushedCfgs, c)
seenConfig = true
}
case *xfer.CommentCard:
default:
if seenConfig {
return expectf("non-comment card %T followed pushed config /shun", card)
}
}
}
if len(pushedCfgs) != 1 || !strings.Contains(string(pushedCfgs[0].Content), newUUID) {
return expectf("pushed /shun cards = %v, want only %s", pushedCfgs, newUUID)
}
// Origin now holds newRow; client did NOT record badRow.
originSigned, err := shun.ListSigned(origin.DB())
if err != nil {
return err
}
foundNew := false
for _, r := range originSigned {
if r.UUID == newUUID {
foundNew = true
}
}
if !foundNew {
return expectf("origin did not record pushed signed erasure %s", newUUID)
}
clientSigned, err := shun.ListSigned(client.DB())
if err != nil {
return err
}
for _, r := range clientSigned {
if r.UUID == badRow.UUID {
return expectf("client recorded unverified signed row %s", badRow.UUID)
}
}
return nil
}
// syncErasureServerPushAuth verifies SP-9.3.1-4: server with pinned
// erasure-key accepts verified signed /shun from Write-only pusher (no Admin),
// refuses any other pushed /shun row with error not authorized to push
// configuration and rolls back earlier content in the request, and without a
// pinned erasure-key applies the Admin rule.
func syncErasureServerPushAuth(t *testing.T) error {
origin, pc := testErasureRepo(t)
pub, priv := testErasureKey(0x41)
_, badPriv := testErasureKey(0x42)
const t0 int64 = 1900000000
clock := simio.NewSimClockAt(time.Unix(t0+10, 0).UTC())
if err := shun.SetPinnedKey(origin.DB(), pub, t0); err != nil {
return err
}
// Give nobody Write (i) ONLY — no Admin (a), no Setup (s).
if _, err := origin.DB().Exec("UPDATE user SET cap='oi' WHERE login='nobody'"); err != nil {
return err
}
goodRow := mustSignErasure(t, priv, pc, hash.SHA1([]byte("good")), t0, t0+86400, shun.KindErase, "ok")
badRow := mustSignErasure(t, badPriv, pc, hash.SHA1([]byte("bad")), t0, t0+86400, shun.KindErase, "bad")
plainRow := shun.Row{UUID: hash.SHA1([]byte("plain")), MTime: t0, Comment: "unsigned"}
// 1. Accepted: Write-only pusher + verified signed /shun.
resp, err := sync.HandleSyncWithOpts(context.Background(), origin, &xfer.Message{
Cards: []xfer.Card{
&xfer.PushCard{ServerCode: "s", ProjectCode: pc},
formatShunCard(goodRow),
},
}, sync.HandleOpts{Clock: clock})
if err != nil {
return err
}
if errs := smCardsOf[*xfer.ErrorCard](resp); len(errs) != 0 {
return expectf("verified signed push refused: %v", errs)
}
// 2. Refused + rollback: file card followed by bad/plain/no-push /shun.
for name, req := range map[string]*xfer.Message{
"wrong-key": {Cards: []xfer.Card{
&xfer.PushCard{ServerCode: "s", ProjectCode: pc},
&xfer.FileCard{UUID: hash.SHA1([]byte("rb-wrong")), Content: []byte("rb-wrong")},
formatShunCard(badRow),
}},
"plain-unsigned": {Cards: []xfer.Card{
&xfer.PushCard{ServerCode: "s", ProjectCode: pc},
&xfer.FileCard{UUID: hash.SHA1([]byte("rb-plain")), Content: []byte("rb-plain")},
formatShunCard(plainRow),
}},
"no-push-card": {Cards: []xfer.Card{
formatShunCard(goodRow),
}},
} {
r, err := sync.HandleSyncWithOpts(context.Background(), origin, req, sync.HandleOpts{Clock: clock})
if err != nil {
return err
}
errs := smCardsOf[*xfer.ErrorCard](r)
if len(errs) != 1 || errs[0].Message != "not authorized to push configuration" {
return expectf("%s: errors = %v, want not authorized to push configuration", name, errs)
}
for _, fc := range smCardsOf[*xfer.FileCard](req) {
if _, exists := blob.Exists(origin.DB(), fc.UUID); exists {
return expectf("%s: file %s was stored despite /shun refusal", name, fc.UUID)
}
}
}
// 3. Server without erasure-key applies Admin rule (non-Admin refused).
keyless, kpc := testErasureRepo(t)
if _, err := keyless.DB().Exec("UPDATE user SET cap='oi' WHERE login='nobody'"); err != nil {
return err
}
kRow := mustSignErasure(t, priv, kpc, hash.SHA1([]byte("k")), t0, t0+86400, shun.KindErase, "k")
kr, err := sync.HandleSync(context.Background(), keyless, &xfer.Message{
Cards: []xfer.Card{
&xfer.PushCard{ServerCode: "s", ProjectCode: kpc},
formatShunCard(kRow),
},
})
if err != nil {
return err
}
errs := smCardsOf[*xfer.ErrorCard](kr)
if len(errs) != 1 || errs[0].Message != "not authorized to push configuration" {
return expectf("keyless server errors = %v, want not authorized to push configuration", errs)
}
return nil
}
// syncErasureFoldAndApplied verifies SP-9.3.1-5: pending erase waits for
// NOT-BEFORE, cancel before NOT-BEFORE neutralizes erase, late cancel is
// ignored, unverified rows are inert, plain shuns apply immediately, and once
// active a plain "erasure applied" row keeps it shunned after key rotation.
func syncErasureFoldAndApplied(t *testing.T) error {
r, pc := testErasureRepo(t)
pub, priv := testErasureKey(0x51)
otherPub, otherPriv := testErasureKey(0x52)
const t0 int64 = 1900000000
const nb int64 = t0 + 86400
if err := shun.SetPinnedKey(r.DB(), pub, t0); err != nil {
return err
}
uErase := hash.SHA1([]byte("u-erase"))
uCancel := hash.SHA1([]byte("u-cancel"))
uLate := hash.SHA1([]byte("u-late"))
uUnver := hash.SHA1([]byte("u-unver"))
uPlain := hash.SHA1([]byte("u-plain"))
if err := shun.Add(r.DB(), uPlain, "manual"); err != nil {
return err
}
for _, row := range []shun.Row{
mustSignErasure(t, priv, pc, uErase, t0, nb, shun.KindErase, "due"),
mustSignErasure(t, priv, pc, uCancel, t0, nb, shun.KindErase, "oops"),
mustSignErasure(t, priv, pc, uCancel, t0+100, t0+100, shun.KindCancel, "undo"),
mustSignErasure(t, priv, pc, uLate, t0, nb, shun.KindErase, "late"),
mustSignErasure(t, priv, pc, uLate, nb+1, nb+1, shun.KindCancel, "too-late"),
mustSignErasure(t, otherPriv, pc, uUnver, t0, t0, shun.KindErase, "wrong-key"),
} {
if _, err := shun.RecordSigned(r.DB(), row); err != nil {
return err
}
}
if _, err := shun.ApplyDue(r.DB(), pc, nb-1); err != nil {
return err
}
if ok, _ := shun.IsShunned(r.DB(), uErase); ok {
return expectf("pending erasure became shunned before NOT-BEFORE")
}
if ok, _ := shun.IsShunned(r.DB(), uPlain); !ok {
return expectf("plain shun not active immediately")
}
if _, err := shun.ApplyDue(r.DB(), pc, nb); err != nil {
return err
}
// Verify plain "erasure applied" row recorded in shun table.
var scom string
if err := r.DB().QueryRow("SELECT scom FROM shun WHERE uuid=?", uErase).Scan(&scom); err != nil {
return expectf("missing applied shun row for %s: %v", uErase, err)
}
if scom != shun.AppliedReason {
return expectf("applied scom = %q, want %q", scom, shun.AppliedReason)
}
// Rotate erasure-key and verify uErase and uLate remain shunned while uCancel and uUnver stay live.
if err := shun.SetPinnedKey(r.DB(), otherPub, nb+10); err != nil {
return err
}
for uuid, want := range map[string]bool{
uErase: true, uLate: true, uPlain: true, uCancel: false, uUnver: false,
} {
got, err := shun.IsShunned(r.DB(), uuid)
if err != nil || got != want {
return expectf("IsShunned(%s) = (%v, %v), want %v", uuid, got, err, want)
}
}
return nil
}
// TestZitSignedErasuresInterop verifies §9.3.1 signed erasures live against
// zit 0.14.22 in both directions: zit adopting erasure-key and verifying
// go-libfossil's Ed25519 signature, and go-libfossil adopting zit's erasure-key
// and verifying zit's Ed25519 signature.
func TestZitSignedErasuresInterop(t *testing.T) {
bin := zitHorizonBinary(t)
dir := t.TempDir()
home := filepath.Join(dir, "home")
if err := os.Mkdir(home, 0o755); err != nil {
t.Fatal(err)
}
// Direction 1: go-libfossil origin pins key + signs erasure -> zit clones & pulls.
origin, pc := testErasureRepo(t)
pub, priv := testErasureKey(0x61)
now := time.Now().UTC().Unix()
if err := shun.SetPinnedKey(origin.DB(), pub, now); err != nil {
t.Fatal(err)
}
secret := []byte("top-secret-erasure-payload\n")
secretUUID := hash.SHA1(secret)
if _, _, err := manifest.Checkin(origin, manifest.CheckinOpts{
Files: []manifest.File{
{Name: "keep.txt", Content: []byte("keep\n")},
{Name: "secret.txt", Content: secret},
},
Comment: "c1", User: "u", Time: time.Unix(now-100, 0).UTC(),
}); err != nil {
t.Fatal(err)
}
srv := httptest.NewServer(sync.XferHandler(origin, sync.HandleSync))
defer srv.Close()
zclone := filepath.Join(dir, "zclone")
zitRun(t, bin, home, dir, "clone", "--no-open", srv.URL, zclone)
gotKeyOut := strings.TrimSpace(zitRun(t, bin, home, zclone, "shun", "key", "show"))
if !strings.Contains(gotKeyOut, shun.FormatPublicKey(pub)) {
t.Fatalf("zit did not adopt erasure-key: got %q, want %s", gotKeyOut, shun.FormatPublicKey(pub))
}
// Sign immediate erasure on go-libfossil origin and have zit pull it.
row := mustSignErasure(t, priv, pc, secretUUID, now, now, shun.KindErase, "leak")
if _, err := shun.RecordSigned(origin.DB(), row); err != nil {
t.Fatal(err)
}
if _, err := shun.ApplyDue(origin.DB(), pc, now); err != nil {
t.Fatal(err)
}
zitRun(t, bin, home, zclone, "pull", srv.URL)
listOut := zitRun(t, bin, home, zclone, "shun", "--list")
if !strings.Contains(listOut, secretUUID) || !strings.Contains(listOut, "signer verified") ||
!strings.Contains(listOut, "applied") {
t.Fatalf("zit did not verify & apply go-libfossil signed erasure:\n%s", listOut)
}
// Direction 2: zit origin generates key & signs erasure -> go-libfossil clones & pulls.
zorigin := filepath.Join(dir, "zorigin")
origin2, _ := testErasureRepo(t)
secret2 := []byte("zit-signed-secret\n")
secret2UUID := hash.SHA1(secret2)
if _, _, err := manifest.Checkin(origin2, manifest.CheckinOpts{
Files: []manifest.File{
{Name: "keep2.txt", Content: []byte("keep2\n")},
{Name: "secret2.txt", Content: secret2},
},
Comment: "c1", User: "u", Time: time.Unix(now-100, 0).UTC(),
}); err != nil {
t.Fatal(err)
}
srv2 := httptest.NewServer(sync.XferHandler(origin2, sync.HandleSync))
defer srv2.Close()
zitRun(t, bin, home, dir, "clone", "--no-open", srv2.URL, zorigin)
zitRun(t, bin, home, zorigin, "shun", "key", "generate")
zPub := strings.TrimSpace(zitRun(t, bin, home, zorigin, "shun", "key", "show"))
zURL := zitServe(t, bin, home, zorigin)
goClone, _, err := sync.Clone(context.Background(),
filepath.Join(dir, "go-clone.fossil"), &sync.HTTPTransport{URL: zURL}, sync.CloneOpts{})
if err != nil {
t.Fatalf("go-libfossil clone from zit: %v", err)
}
defer goClone.Close()
adoptedPub, ok, err := shun.PinnedKey(goClone.DB())
if err != nil || !ok || !strings.Contains(zPub, shun.FormatPublicKey(adoptedPub)) {
t.Fatalf("go-libfossil adopted key = (%x, %v, %v), zit key = %q", adoptedPub, ok, err, zPub)
}
// Have zit sign an immediate erasure and go-libfossil pull it.
zitRun(t, bin, home, zorigin, "shun", "--force", "--sign", "--now", "--reason", "from-zit", secret2UUID)
if _, err := sync.Sync(context.Background(), goClone, &sync.HTTPTransport{URL: zURL}, sync.SyncOpts{Pull: true}); err != nil {
t.Fatalf("go-libfossil pull from zit: %v", err)
}
shunned, err := shun.IsShunned(goClone.DB(), secret2UUID)
if err != nil || !shunned {
t.Fatalf("go-libfossil did not verify & apply zit signed erasure: shunned=%v err=%v", shunned, err)
}
var appliedScom string
if err := goClone.DB().QueryRow("SELECT scom FROM shun WHERE uuid=?", secret2UUID).Scan(&appliedScom); err != nil {
t.Fatalf("read applied shun row: %v", err)
}
if appliedScom != shun.AppliedReason {
t.Fatalf("go-libfossil applied scom = %q, want %q", appliedScom, shun.AppliedReason)
}
}