unified-storage: Sql kv compat tests fields check (#115891)

* add tests to check that resource_history, resource and resource_version are being populated properly with sqlkv
This commit is contained in:
Will Assis
2026-01-08 15:58:32 -05:00
committed by GitHub
parent e95f8bf843
commit f028b9dbdb
3 changed files with 438 additions and 3 deletions
+7 -1
View File
@@ -864,11 +864,15 @@ func (d *dataStore) applyBackwardsCompatibleChanges(ctx context.Context, tx db.T
return nil
}
generation := event.Object.GetGeneration()
if key.Action == DataActionDeleted {
generation = 0
}
_, err := dbutil.Exec(ctx, tx, sqlKVUpdateLegacyResourceHistory, sqlKVLegacyUpdateHistoryRequest{
SQLTemplate: sqltemplate.New(kv.dialect),
GUID: key.GUID,
PreviousRV: event.PreviousRV,
Generation: event.Object.GetGeneration(),
Generation: generation,
})
if err != nil {
@@ -910,6 +914,7 @@ func (d *dataStore) applyBackwardsCompatibleChanges(ctx context.Context, tx db.T
Resource: key.Resource,
Namespace: key.Namespace,
Name: key.Name,
Action: action,
Folder: key.Folder,
PreviousRV: event.PreviousRV,
})
@@ -920,6 +925,7 @@ func (d *dataStore) applyBackwardsCompatibleChanges(ctx context.Context, tx db.T
case DataActionDeleted:
_, err := dbutil.Exec(ctx, tx, sqlKVDeleteLegacyResource, sqlKVLegacySaveRequest{
SQLTemplate: sqltemplate.New(kv.dialect),
Group: key.Group,
Resource: key.Resource,
Namespace: key.Namespace,
Name: key.Name,