// Package coordinatorcontract shares recorded, credential-free wire exchanges // between the instance handler and runner transport tests. package coordinatorcontract import ( "embed" "encoding/json" ) //go:embed testdata/*.json var files embed.FS type Packet struct { Path string `json:"path"` Request json.RawMessage `json:"request"` Response json.RawMessage `json:"response"` } func Load(name string) (Packet, error) { var p Packet raw, err := files.ReadFile("testdata/" + name + ".json") if err == nil { err = json.Unmarshal(raw, &p) } return p, err } func Canonical(raw []byte) string { var v any if json.Unmarshal(raw, &v) != nil { return "invalid JSON" } out, _ := json.Marshal(v) return string(out) }