fix(IdGenerator): include month into generated id

This commit is contained in:
Cyrille Nofficial 2021-02-22 18:35:48 +01:00
parent 3180c1b540
commit 185ec4032d
2 changed files with 2 additions and 3 deletions

View File

@ -166,7 +166,7 @@ func NewDateBasedGenerator() *DateBasedGenerator {
muCpt: sync.Mutex{},
cpt: 0,
idTemplate: "%s-%d",
start: time.Now().Format("2006011504"),
start: time.Now().Format("200601021504"),
}
}

View File

@ -54,7 +54,6 @@ func TestRecorder_Record(t *testing.T) {
start: "record",
}
go func() {
if err := recorder.Start(); err == nil {
t.Fatalf("unable to start recorder: %v", err)
@ -130,7 +129,7 @@ func loadImage(t *testing.T, imgPath string, id string) *events.FrameMessage {
func TestDateBasedGenerator_Next(t *testing.T) {
log.SetLevel(log.InfoLevel)
expectedFmt := "[0-9]{4}[01][0-9][0-2][0-9][0-5][0-9]-[0-9]+"
expectedFmt := "[0-9]{4}[01][0-9][0-3][0-9][0-2][0-9][0-5][0-9]-[0-9]+"
r, err := regexp.Compile(expectedFmt)
if err != nil {
t.Fatalf("unable to compile expected regex: %v", err)