Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate update test #2051

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading