Chore: Fix flaky sqlstore annotation test (#28527)

This commit is contained in:
Emil Hessman
2020-10-26 07:45:30 +01:00
committed by GitHub
parent 639460a789
commit 9a241a2a4f
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -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 {
+2
View File
@@ -11,6 +11,8 @@ import (
)
func TestAnnotations(t *testing.T) {
mockTimeNow()
defer resetTimeNow()
InitTestDB(t)
Convey("Testing annotation saving/loading", t, func() {