-
Notifications
You must be signed in to change notification settings - Fork 31
Add BrokerURL to the cache ad when broker is enabled #2792
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
base: main
Are you sure you want to change the base?
Conversation
- The broker is now used by both the Origin and Cache services. This commit moves its metrics to a common location so they can be accessed by both, rather than being coupled to the Origin.
- Checks Origin.EnableBroker or Cache.EnableBroker and sets the broker URL appropriately
- This mirrors the origin implementation and allows tracking of cache broker connections
c8a337e to
4e866ee
Compare
- The test verifies that: 1. The cache broker metric collector exists 2. The cache broker is properly enabled 3. The broker listener starts up successfully 4. The cache polls the broker endpoint (visible in logs) 5. Broker metrics can be incremented
4e866ee to
cc1f153
Compare
|
|
||
| // SetBrokerURL sets the broker URL in the advertisement for servers that have broker support enabled. | ||
| // Returns the broker URL string if successful, or an empty string if not applicable. | ||
| func SetBrokerURL(ad *server_structs.OriginAdvertiseV2, serverType server_structs.ServerType, prefixes []string) error { |
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 you add tests for this function?
- Test with multiple prefixes: verify broker URL is not set
- Test with broker disabled: verify broker URL is not set
- Test with invalid broker endpoint: verify error is returned
| ) | ||
|
|
||
| // Spin up a federation and verifies that the cache broker infrastructure is properly configured. | ||
| func TestBrokerApi(t *testing.T) { |
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.
This seems like a strange test. It appears that we are just manually incrementing the counter ourselves and then checking that it has increased? This doesn't really seem to test that the connection was actually made.
This PR consolidates the BrokerURL getter logics for Origin and Cache in their advertising process, and adds a new fed test for Broker-enabled Cache.
See the commit messages for details.
Not sure if this PR conflicts with the current Broker work you're doing @patrickbrophy