Beispiel #1
0
func fuzzTimeSlice(t *[]time.Time, c fuzz.Continue) {
	var i uint64
	rv := make([]time.Time, 0)
	count := c.RandUint64() % 50
	for i = 0; i < count; i++ {
		var tmp time.Time
		fuzzTime(&tmp, c)
		rv = append(rv, tmp)
	}
	*t = rv
}
Beispiel #2
0
// AddTarget generates a fake target and adds it to a repo.
func AddTarget(role string, r *tuf.Repo) (name string, meta data.FileMeta, content []byte, err error) {
	randness := fuzz.Continue{}
	content = RandomByteSlice(1024)
	name = randness.RandString()
	t := data.FileMeta{
		Length: int64(len(content)),
		Hashes: data.Hashes{
			"sha256": utils.DoHash("sha256", content),
			"sha512": utils.DoHash("sha512", content),
		},
	}
	files := data.Files{name: t}
	_, err = r.AddTargets(role, files)
	return
}