| 1 |
//go:build !notest |
| 2 |
// +build !notest |
| 3 |
|
| 4 |
/* |
| 5 |
Copyright 2020 The Kubernetes Authors. |
| 6 |
|
| 7 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 |
you may not use this file except in compliance with the License. |
| 9 |
You may obtain a copy of the License at |
| 10 |
|
| 11 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
|
| 13 |
Unless required by applicable law or agreed to in writing, software |
| 14 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 15 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 |
See the License for the specific language governing permissions and |
| 17 |
limitations under the License. |
| 18 |
*/ |
| 19 |
|
| 20 |
package v1 |
| 21 |
|
| 22 |
import ( |
| 23 |
"math/rand" |
| 24 |
"time" |
| 25 |
|
| 26 |
"sigs.k8s.io/randfill" |
| 27 |
) |
| 28 |
|
| 29 |
// Fuzz satisfies randfill.SimpleSelfFiller. |
| 30 |
func (t *Time) RandFill(r *rand.Rand) { |
| 31 |
if t == nil { |
| 32 |
return |
| 33 |
} |
| 34 |
// Allow for about 1000 years of randomness. Leave off nanoseconds |
| 35 |
// because JSON doesn't represent them so they can't round-trip |
| 36 |
// properly. |
| 37 |
t.Time = time.Unix(r.Int63n(1000*365*24*60*60), 0) |
| 38 |
} |
| 39 |
|
| 40 |
// ensure Time implements randfill.SimpleSelfFiller |
| 41 |
var _ randfill.SimpleSelfFiller = &Time{} |