mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 03:13:49 +08:00
Unified Storage: Don't read before create (#102906)
* Unified Storage: Don't read before create * test: use the existing test infra * fix: support pq We use pgx, but it seems to be wrapped in a pq driver shim, causing the errors to be remapped to pq's type. Weird situation. * feat: support CDK backend * revert: there is a postgres_tests block * fix(CDK): only check existence on ADDED updates * fix(CDK): use ReadResource to deal with deleted files
This commit is contained in:

committed by
GitHub

parent
827d86a985
commit
f0a6327edc
@ -2456,6 +2456,21 @@ func RunTestGuaranteedUpdateChecksStoredData(ctx context.Context, t *testing.T,
|
||||
}
|
||||
}
|
||||
|
||||
func RunTestValidUpdate(ctx context.Context, t *testing.T, store storage.Interface) {
|
||||
pod := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test-ns"}}
|
||||
key, pod := testPropagateStore(ctx, t, store, pod)
|
||||
|
||||
err := store.GuaranteedUpdate(ctx, key, &example.Pod{}, false, nil,
|
||||
storage.SimpleUpdate(func(o runtime.Object) (runtime.Object, error) {
|
||||
pod := o.(*example.Pod)
|
||||
pod.Spec.Hostname = "example"
|
||||
return pod, nil
|
||||
}), pod)
|
||||
if err != nil {
|
||||
t.Errorf("got error on update: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func RunTestGuaranteedUpdateWithConflict(ctx context.Context, t *testing.T, store storage.Interface) {
|
||||
key, _ := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test-ns"}})
|
||||
|
||||
|
Reference in New Issue
Block a user