From 4852aef43365f466673ac070a2828d29ccd25fd8 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Sun, 1 Sep 2024 14:14:48 -0400 Subject: [PATCH] Remove duplicate update test Duplicate updates are not allowed at the datastore level, so this test wasn't testing a valid call anyway --- pkg/datastore/test/tuples.go | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/pkg/datastore/test/tuples.go b/pkg/datastore/test/tuples.go index d9429dd7a1..3dcf78183c 100644 --- a/pkg/datastore/test/tuples.go +++ b/pkg/datastore/test/tuples.go @@ -394,16 +394,6 @@ func DeleteRelationshipsTest(t *testing.T, tester DatastoreTester) { nil, testTuples, }, - { - "duplicates", - append(testTuples, testTuples[0]), - &v1.RelationshipFilter{ - ResourceType: testResourceNamespace, - OptionalResourceId: "resource0", - }, - testTuples[1:], - testTuples[:1], - }, } for _, tt := range table { @@ -420,17 +410,13 @@ func DeleteRelationshipsTest(t *testing.T, tester DatastoreTester) { tRequire := testfixtures.TupleChecker{Require: require, DS: ds} - // NOTE: we write tuples in multiple calls to ReadWriteTransaction because it is not allowed to change - // the same tuple in the same transaction. + toTouch := make([]*core.RelationTupleUpdate, 0, len(tt.inputTuples)) + for _, tpl := range tt.inputTuples { + toTouch = append(toTouch, tuple.Touch(tpl)) + } + _, err = ds.ReadWriteTx(ctx, func(ctx context.Context, rwt datastore.ReadWriteTransaction) error { - for _, tpl := range tt.inputTuples { - update := tuple.Touch(tpl) - err := rwt.WriteRelationships(ctx, []*core.RelationTupleUpdate{update}) - if err != nil { - return err - } - } - return nil + return rwt.WriteRelationships(ctx, toTouch) }) require.NoError(err)