Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Blame · server/index_hook_test.go

Line attribution on main · 35 line(s)

dced06da
Keenan Nemetz
9d ago
1 package server_test
2
3 // The index used to become current on the next read, which put the delta of a
4 // push inside a page render. Post-receive applies it as the push lands; this is
5 // the wiring test: a push, then a query with no Ensure in between.
6
7 import (
8 "testing"
9
d37d301f
Keenan Nemetz
15h ago
10 "rodent.software/vole/forge/index"
dced06da
Keenan Nemetz
9d ago
11 )
12
13 func TestPushRefreshesTheIndexBeforeTheNextRead(t *testing.T) {
14 t.Parallel()
15 f := newFixture(t)
16 f.publish(f.repo)
17 m := mustRepo(t, f)
18
19 work := f.issuesRepo(t, issueFiles(testIssueID, "Indexed by the push", "body\n"))
20 if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "HEAD:refs/heads/vole"); err != nil {
21 t.Fatalf("push issues: %v\n%s", err, errs)
22 }
23
24 // No Ensure: post-receive ran in the push, so the rows are already there.
25 rows, err := f.srv.Index.Issues(m.ID, index.Filter{})
26 if err != nil {
27 t.Fatal(err)
28 }
29 if len(rows) != 1 || rows[0].ID != testIssueID {
30 t.Fatalf("the push did not refresh the index: %+v", rows)
31 }
32 if rows[0].Title != "Indexed by the push" {
33 t.Fatalf("row title = %q", rows[0].Title)
34 }
35 }