From 185ec4032d2525f1b18f2eed73dd984c74d6df83 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Mon, 22 Feb 2021 18:35:48 +0100 Subject: [PATCH] fix(IdGenerator): include month into generated id --- part/record.go | 2 +- part/record_test.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/part/record.go b/part/record.go index c3f87f5..edcf936 100644 --- a/part/record.go +++ b/part/record.go @@ -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"), } } diff --git a/part/record_test.go b/part/record_test.go index 15e9770..4634ed5 100644 --- a/part/record_test.go +++ b/part/record_test.go @@ -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)