Skip to content

Commit

Permalink
Merge pull request #2051 from josephschorr/remove-duplicate-test
Browse files Browse the repository at this point in the history
Remove duplicate update test
  • Loading branch information
josephschorr authored Sep 2, 2024
2 parents ad4632c + 4852aef commit 7c1078d
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions pkg/datastore/test/tuples.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)

Expand Down

0 comments on commit 7c1078d

Please sign in to comment.