Skip to content

Commit

Permalink
test: add benchmark for UUID mapper (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl authored Feb 1, 2023
1 parent 2c2a00f commit 775b065
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal/relationtuple/uuid_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,27 @@ func TestMapper(t *testing.T) {
})
})
}

func BenchmarkReadOnlyMapper(b *testing.B) {
ctx := context.Background()
reg := driver.NewSqliteTestRegistry(b, false,
driver.WithNamespaces([]*namespace.Namespace{{Name: "test"}}))
m := reg.ReadOnlyMapper()

b.Run("FromTuple", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := m.FromTuple(ctx, &ketoapi.RelationTuple{
Namespace: "test",
Object: "object",
Relation: "relation",
SubjectSet: &ketoapi.SubjectSet{
Namespace: "test",
Object: "subject object",
Relation: "relation",
},
})
assert.NoError(b, err)
}

})
}

0 comments on commit 775b065

Please sign in to comment.