Comments (4)
It's likely that we don't want setting the connection in the context to be a public API just to simplify testing of the usage of RBAC interceptors. The functionality to obtain local and peer addresses are otherwise available via the peer package. I do wonder though why the RBAC filter does not simply use the public peer.LocalAddr
which is available in the context.
Alternatively, I tried to set up a full stack, but it increases the preparation complexity and make the test slow.
A lot of the tests in grpc-go work like this, so that's the approach I would recommend. You can look at examples in https://github.com/grpc/grpc-go/blob/c04b085930ce33ee83cc3f92dbe7632031e127a9/authz/grpc_authz_end2end_test.go. Each test that starts a client and a server run in less than 1-2 millisecond. There's maybe a bit more boilerplate for setup, but that's enough to justify making this API public, and it'll make the tests less brittle than relying on internal APIs.
from grpc-go.
@zasweq do you happen to remember why we directly want to use the conn.LocalAddr
rather than peer.LocalAddr
in the RBAC filter code:
grpc-go/internal/xds/rbac/rbac_engine.go
Lines 223 to 228 in c04b085
from grpc-go.
Anyways, I think your best option for your use case seems to be end to end tests that don't rely on how the RBAC filter communicates with gRPC's transport. Let us know if that doesn't work for you, and why.
from grpc-go.
Ok, thank you. I will find another way to build a policy tester without setting up the complete gRPC stack.
from grpc-go.
Related Issues (20)
- Where are the v1.66.1 release notes? HOT 3
- Uptick of FLOW_CONTROL_ERROR errors in CI after updating to 1.66.0 HOT 3
- google.golang.org/grpc v1.66.1 is missing a retraction HOT 4
- gRPC Server Sends RST_STREAM without trailers when TCP Reassembly occurs HOT 9
- 1.66.0 - increase in produced zero addresses HOT 10
- Flaky test: TestServeAndCloseDoNotRace HOT 2
- panic: send on closed channel HOT 3
- mem.NewBuffer() should look at slice capacity? HOT 2
- Long running streams fail HOT 4
- "package maps is not in GOROOT" with go1.18 HOT 5
- Move Outlier Detection to be able to use it outside of xDS
- Flaky test: Test/ProducerStreamStartsAfterReady HOT 3
- More resolvers to support third-party registry HOT 1
- picker's Done callback didn't triger when client early quit on client and server stream HOT 1
- High memory usage when XDS is used HOT 16
- Allow per service codecs HOT 1
- xds: change `ServerConfig` type to have a single method to return all configured dial options
- Flaky test suite extras
- is grpc-go V1.59.0 affected by "CVE-2024-7246" HOT 1
- Buffer leak tests are not enabled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-go.