Storage: Show history+trash using the list command (#99009)

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
Ryan McKinley
2025-01-17 15:54:25 +03:00
committed by GitHub
co-authored by Stephanie Hingtgen
parent 67252dfa46
commit 356b32008b
54 changed files with 1325 additions and 724 deletions
+14 -1
View File
@@ -119,14 +119,27 @@ func TestSimpleServer(t *testing.T) {
obj.SetAnnotation("test", "hello")
obj.SetUpdatedTimestampMillis(now)
obj.SetUpdatedBy(testUserA.GetUID())
obj.SetLabels(map[string]string{
utils.LabelKeyGetTrash: "", // should not be allowed to save this!
})
raw, err = json.Marshal(tmp)
require.NoError(t, err)
updated, err := server.Update(ctx, &UpdateRequest{
Key: key,
Value: raw,
ResourceVersion: created.ResourceVersion})
require.NoError(t, err)
require.Equal(t, int32(400), updated.Error.Code) // bad request
// remove the invalid labels
obj.SetLabels(nil)
raw, err = json.Marshal(tmp)
require.NoError(t, err)
updated, err = server.Update(ctx, &UpdateRequest{
Key: key,
Value: raw,
ResourceVersion: created.ResourceVersion})
require.NoError(t, err)
require.Nil(t, updated.Error)
require.True(t, updated.ResourceVersion > created.ResourceVersion)