Chore: Fix flaky sqlstore annotation test (#28527)
This commit is contained in:
@@ -35,7 +35,7 @@ func (r *SqlAnnotationRepo) Save(item *annotations.Item) error {
|
||||
return inTransaction(func(sess *DBSession) error {
|
||||
tags := models.ParseTagPairs(item.Tags)
|
||||
item.Tags = models.JoinTagPairs(tags)
|
||||
item.Created = time.Now().UnixNano() / int64(time.Millisecond)
|
||||
item.Created = timeNow().UnixNano() / int64(time.Millisecond)
|
||||
item.Updated = item.Created
|
||||
if item.Epoch == 0 {
|
||||
item.Epoch = item.Created
|
||||
@@ -81,7 +81,7 @@ func (r *SqlAnnotationRepo) Update(item *annotations.Item) error {
|
||||
return errors.New("Annotation not found")
|
||||
}
|
||||
|
||||
existing.Updated = time.Now().UnixNano() / int64(time.Millisecond)
|
||||
existing.Updated = timeNow().UnixNano() / int64(time.Millisecond)
|
||||
existing.Text = item.Text
|
||||
|
||||
if item.Epoch != 0 {
|
||||
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
)
|
||||
|
||||
func TestAnnotations(t *testing.T) {
|
||||
mockTimeNow()
|
||||
defer resetTimeNow()
|
||||
InitTestDB(t)
|
||||
|
||||
Convey("Testing annotation saving/loading", t, func() {
|
||||
|
||||
Reference in New Issue
Block a user