Commit 9a241a2a by Emil Hessman Committed by GitHub

Chore: Fix flaky sqlstore annotation test (#28527)

parent 639460a7
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment