Annotations: Fix database lock while updating annotations (#71199)

This commit is contained in:
Emil Tullstedt
2023-07-07 15:21:49 +02:00
committed by GitHub
parent 217265baee
commit 56f52dc97e
2 changed files with 36 additions and 1 deletions
@@ -368,6 +368,35 @@ func TestIntegrationAnnotations(t *testing.T) {
assert.Greater(t, items[0].Updated, items[0].Created)
})
t.Run("Can update annotation with additional tags", func(t *testing.T) {
query := &annotations.ItemQuery{
OrgID: 1,
DashboardID: 1,
From: 0,
To: 15,
SignedInUser: testUser,
}
items, err := repo.Get(context.Background(), query)
require.NoError(t, err)
annotationId := items[0].ID
err = repo.Update(context.Background(), &annotations.Item{
ID: annotationId,
OrgID: 1,
Text: "something new",
Tags: []string{"newtag1", "newtag3"},
})
require.NoError(t, err)
items, err = repo.Get(context.Background(), query)
require.NoError(t, err)
assert.Equal(t, annotationId, items[0].ID)
assert.Equal(t, []string{"newtag1", "newtag3"}, items[0].Tags)
assert.Equal(t, "something new", items[0].Text)
assert.Greater(t, items[0].Updated, items[0].Created)
})
t.Run("Can update annotations with data", func(t *testing.T) {
query := &annotations.ItemQuery{
OrgID: 1,