-
Notifications
You must be signed in to change notification settings - Fork 278
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
grpc middleware order assertion #1395
grpc middleware order assertion #1395
Conversation
8a89d6f
to
9d68e97
Compare
498f8eb
to
413a39b
Compare
413a39b
to
f5e6ea1
Compare
pkg/cmd/server/middleware.go
Outdated
var none = uuid.NewString() | ||
|
||
func inTest() bool { | ||
return flag.Lookup("test.v") != nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use the function we already have defined in the testutil package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any. Could you point me to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spicedb/pkg/spiceerrors/bug.go
Line 10 in 5d33a67
func isInTests() bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's unexported. If you are cool with that, I can export it
634618d
to
035fd62
Compare
See dependency addressed in 21b87a4
035fd62
to
baae1a7
Compare
The behaviour of gRPC streaming API middlewares can be surprising w.r.t to order of execution. This is an attempt to force the developer introducing gRPC middleware in SpiceDB to be explicit about the order.
When run in tests, the fluent API builder will wrap each middlewares into another interceptor that will run assertions on the order of execution, and panic if that expected order is not met.