internal/kobject: improve error JSON representation
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m55s
Test / Hakurei (push) Successful in 3m52s
Test / ShareFS (push) Successful in 3m44s
Test / Sandbox (race detector) (push) Successful in 5m25s
Test / Hakurei (race detector) (push) Successful in 6m35s
Test / Flake checks (push) Successful in 1m22s
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m55s
Test / Hakurei (push) Successful in 3m52s
Test / ShareFS (push) Successful in 3m44s
Test / Sandbox (race detector) (push) Successful in 5m25s
Test / Hakurei (race detector) (push) Successful in 6m35s
Test / Flake checks (push) Successful in 1m22s
This is now usable by internal/report. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -11,8 +11,10 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"hakurei.app/check"
|
||||
"hakurei.app/internal/kobject"
|
||||
"hakurei.app/internal/report"
|
||||
"hakurei.app/internal/stub"
|
||||
"hakurei.app/internal/uevent"
|
||||
)
|
||||
|
||||
type representableUE struct{ stub.UniqueError }
|
||||
@@ -38,10 +40,25 @@ func TestDispatch(t *testing.T) {
|
||||
Message: "rejecting coldboot loop",
|
||||
Err: stub.UniqueError(0xcafe),
|
||||
},
|
||||
}, true, []string{
|
||||
`{"kind":"fatal","message":"rejecting coldboot loop","error":"unique error 51966 injected by the test suite"}
|
||||
`,
|
||||
}, "dispatch: rejecting coldboot loop: unique error 51966 injected by the test suite\n", nil},
|
||||
{
|
||||
Severity: report.Inconsistent,
|
||||
Message: "processed inconsistent uevent",
|
||||
Err: (&kobject.Event{
|
||||
Action: uevent.KOBJ_ADD,
|
||||
DevPath: "\x00",
|
||||
Env: map[string]string{"V": "\xfd"},
|
||||
Sequence: 2,
|
||||
}).NewError(kobject.EDuplicateAdd, &kobject.Object{
|
||||
State: kobject.StateNew,
|
||||
DevPath: "\x00",
|
||||
Env: map[string]string{"V": "\xff"},
|
||||
}),
|
||||
},
|
||||
}, true, []string{`{"kind":"fatal","message":"rejecting coldboot loop","error":"unique error 51966 injected by the test suite"}
|
||||
`, `{"kind":"inconsistent","message":"processed inconsistent uevent","error":{"fault":1,"event":{"action":"add","devpath":"\u0000","env":{"V":"\ufffd"},"seqnum":2,"subsystem":""},"object":{"state":1,"devpath":"\u0000","subsystem":"","env":{"V":"\ufffd"}}}}
|
||||
`}, `dispatch: rejecting coldboot loop: unique error 51966 injected by the test suite
|
||||
dispatch: processed inconsistent uevent: duplicate add event on devpath "\x00"
|
||||
`, nil},
|
||||
|
||||
{"strict", report.DStrict, []report.Error{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user