Skip to content

Commit

Permalink
Remove duplicate update test
Browse files Browse the repository at this point in the history
Duplicate updates are not allowed at the datastore level, so this test wasn't testing a valid call anyway
  • Loading branch information
josephschorr committed Sep 1, 2024
1 parent 507f566 commit 4852aef
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 4852aef

Please sign in to comment.