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.
|
70c9ad4e
Keenan Nemetz
3h ago
|
1 | package agent |
| 2 | ||
| 3 | import ( | |
| 4 | "strings" | |
| 5 | "testing" | |
| 6 | "unicode/utf8" | |
| 7 | ||
| 8 | "rodent.software/vole/ci/runs" | |
| 9 | ) | |
| 10 | ||
| 11 | // A failure that never reached a step keeps one line for the record: the log already | |
| 12 | // holds the whole story, and the record's copy is display text beside a status. | |
| 13 | func TestFailureLineIsOneBoundedLine(t *testing.T) { | |
| 14 | t.Parallel() | |
| 15 | if got, want := failureLine("building image-file \"verify\" exited 125\nthe disk is full"), | |
| 16 | `building image-file "verify" exited 125 the disk is full`; got != want { | |
| 17 | t.Fatalf("failureLine = %q, want %q", got, want) | |
| 18 | } | |
| 19 | long := strings.Repeat("x", runs.MaxFailureMessage+50) | |
| 20 | if got := len(failureLine(long)); got != runs.MaxFailureMessage { | |
| 21 | t.Fatalf("a long message is %d bytes, want %d", got, runs.MaxFailureMessage) | |
| 22 | } | |
| 23 | // The cut can land in the middle of a rune, and the record refuses text that is | |
| 24 | // not valid UTF-8; bound it without producing bytes it would refuse. | |
| 25 | multibyte := "a" + strings.Repeat("é", 200) | |
| 26 | cut := failureLine(multibyte) | |
| 27 | if !utf8.ValidString(cut) { | |
| 28 | t.Fatalf("the cut message is not valid UTF-8: %q", cut) | |
| 29 | } | |
| 30 | if len(cut) > runs.MaxFailureMessage { | |
| 31 | t.Fatalf("the cut message is %d bytes", len(cut)) | |
| 32 | } | |
| 33 | } |