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/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

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

refactor

c5902451905acdaa478f8476844ccd4a510d9ca9 · Keenan Nemetz · 17d ago · parent ec2aba4b

internal/hook/records_test.go → server/hook/records_test.go +16−16

@@ -12,13 +12,13 @@ import (
12 12 "testing"
13 13 "time"
14 14
15 "github.com/rodent-software/vole/internal/access"
16 "github.com/rodent-software/vole/internal/gitx"
17 "github.com/rodent-software/vole/internal/id"
18 "github.com/rodent-software/vole/internal/identity"
19 "github.com/rodent-software/vole/internal/issues"
20 "github.com/rodent-software/vole/internal/repo"
21 "github.com/rodent-software/vole/internal/runs"
15 "github.com/rodent-software/vole/ci/runs"
16 "github.com/rodent-software/vole/core/git"
17 "github.com/rodent-software/vole/core/id"
18 "github.com/rodent-software/vole/forge/access"
19 "github.com/rodent-software/vole/forge/identity"
20 "github.com/rodent-software/vole/forge/repo"
21 "github.com/rodent-software/vole/metadata"
22 22 )
23 23
24 24 // recordFixture is everything a record push needs: a repository, a roster, an ACL naming
@@ -152,11 +152,11 @@ func (f *recordFixture) record(attempt int, signer string) runs.Record {
152 152 func (f *recordFixture) push(rec runs.Record) string {
153 153 f.t.Helper()
154 154 g := f.repo.Git()
155 commit, err := runs.WriteRecord(g, issues.Ref, rec, "runner", nil)
155 commit, err := runs.WriteRecord(g, metadata.Ref, rec, "runner", nil)
156 156 if err != nil {
157 157 f.t.Fatalf("writing the record: %v", err)
158 158 }
159 if err := g.UpdateRef(issues.Ref, commit); err != nil {
159 if err := g.UpdateRef(metadata.Ref, commit); err != nil {
160 160 f.t.Fatal(err)
161 161 }
162 162 old := f.current
@@ -168,7 +168,7 @@ func (f *recordFixture) push(rec runs.Record) string {
168 168 func (f *recordFixture) preReceive(actor, actorID, old, new string) (int, string) {
169 169 f.t.Helper()
170 170 if old == "" {
171 old = gitx.ZeroSHA
171 old = git.ZeroSHA
172 172 }
173 173 var out strings.Builder
174 174 code := PreReceive(Config{
@@ -177,7 +177,7 @@ func (f *recordFixture) preReceive(actor, actorID, old, new string) (int, string
177 177 ActorID: actorID,
178 178 UsersDB: f.usersDB,
179 179 RunsDB: f.runsDB,
180 In: strings.NewReader(old + " " + new + " " + issues.Ref + "\n"),
180 In: strings.NewReader(old + " " + new + " " + metadata.Ref + "\n"),
181 181 Out: &out,
182 182 })
183 183 return code, out.String()
@@ -236,7 +236,7 @@ func TestARecordNeedsNoSignature(t *testing.T) {
236 236 if err != nil {
237 237 t.Fatal(err)
238 238 }
239 tree, err := gitx.WriteFlatTree(g, files)
239 tree, err := git.WriteFlatTree(g, files)
240 240 if err != nil {
241 241 t.Fatal(err)
242 242 }
@@ -244,7 +244,7 @@ func TestARecordNeedsNoSignature(t *testing.T) {
244 244 if err != nil {
245 245 t.Fatal(err)
246 246 }
247 if err := g.UpdateRef(issues.Ref, commit); err != nil {
247 if err := g.UpdateRef(metadata.Ref, commit); err != nil {
248 248 t.Fatal(err)
249 249 }
250 250 if code, out := f.preReceive("runner", f.runnerID, "", commit); code != 0 {
@@ -268,7 +268,7 @@ func TestARecordIsAppendOnlyAtTheGate(t *testing.T) {
268 268 // The edit has to change the blob: a record that says the same thing in the same
269 269 // bytes would be an empty commit, which git would refuse to make anyway.
270 270 files[path] = []byte(strings.Replace(string(files[path]), "exit: 0", "exit: 0\nnote: edited", 1))
271 tree, err := gitx.WriteFlatTree(g, files)
271 tree, err := git.WriteFlatTree(g, files)
272 272 if err != nil {
273 273 t.Fatal(err)
274 274 }
@@ -293,11 +293,11 @@ func TestARecordMustDescribeTheLeasedJob(t *testing.T) {
293 293 f := newRecordFixture(t)
294 294 g := f.repo.Git()
295 295 rec := f.record(99, f.runnerID)
296 commit, err := runs.WriteRecord(g, issues.Ref, rec, "runner", nil)
296 commit, err := runs.WriteRecord(g, metadata.Ref, rec, "runner", nil)
297 297 if err != nil {
298 298 t.Fatal(err)
299 299 }
300 if err := g.UpdateRef(issues.Ref, commit); err != nil {
300 if err := g.UpdateRef(metadata.Ref, commit); err != nil {
301 301 t.Fatal(err)
302 302 }
303 303 code, out := f.preReceive("runner", f.runnerID, "", commit)