github.com/spotmaxtech/k8s-apimachinery-v0260@v0.0.1/pkg/apis/meta/v1/time_fuzz.go (about) 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 "time" 24 25 fuzz "github.com/google/gofuzz" 26 ) 27 28 // Fuzz satisfies fuzz.Interface. 29 func (t *Time) Fuzz(c fuzz.Continue) { 30 if t == nil { 31 return 32 } 33 // Allow for about 1000 years of randomness. Leave off nanoseconds 34 // because JSON doesn't represent them so they can't round-trip 35 // properly. 36 t.Time = time.Unix(c.Rand.Int63n(1000*365*24*60*60), 0) 37 } 38 39 // ensure Time implements fuzz.Interface 40 var _ fuzz.Interface = &Time{}