mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-21 23:00:42 -08:00
feat(report): GitHub Dependency Snapshots support (#1522)
Co-authored-by: Shira Cohen <97398476+ShiraCohen33@users.noreply.github.com> Co-authored-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
23
pkg/clock/clock.go
Normal file
23
pkg/clock/clock.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package clock
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"k8s.io/utils/clock"
|
||||
clocktesting "k8s.io/utils/clock/testing"
|
||||
)
|
||||
|
||||
var c clock.Clock = clock.RealClock{}
|
||||
|
||||
// SetFakeTime sets a fake time for testing.
|
||||
func SetFakeTime(t *testing.T, fakeTime time.Time) {
|
||||
c = clocktesting.NewFakeClock(fakeTime)
|
||||
t.Cleanup(func() {
|
||||
c = clock.RealClock{}
|
||||
})
|
||||
}
|
||||
|
||||
func Now() time.Time {
|
||||
return c.Now()
|
||||
}
|
||||
Reference in New Issue
Block a user