github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/status/test/generate.go (about) 1 package statustest 2 3 import ( 4 "github.com/TrueCloudLab/frostfs-api-go/v2/status" 5 ) 6 7 // Detail returns status.Detail filled with static random values. 8 func Detail(empty bool) *status.Detail { 9 m := new(status.Detail) 10 11 if !empty { 12 m.SetID(345) 13 m.SetValue([]byte("value")) 14 } 15 16 return m 17 } 18 19 // Details returns several status.Detail messages filled with static random values. 20 func Details(empty bool) []status.Detail { 21 var res []status.Detail 22 23 if !empty { 24 res = append(res, 25 *Detail(false), 26 *Detail(false), 27 ) 28 } 29 30 return res 31 } 32 33 // Status returns status.Status messages filled with static random values. 34 func Status(empty bool) *status.Status { 35 m := new(status.Status) 36 37 if !empty { 38 m.SetCode(765) 39 m.SetMessage("some string") 40 status.SetStatusDetails(m, Details(false)) 41 } 42 43 return m 44 }