-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[improve] [broker] Verify at least one URL is present for cluster creation #20821
base: master
Are you sure you want to change the base?
Conversation
Checking if `serviceUrl`, `serviceUrlTls`, `brokerServiceUrl`, or `brokerServiceUrlTls` are not null. Then proceeds to throw `IllegalArgumentException` if either of `serviceUrl`, `serviceUrlTls` or `brokerServiceUrl`, `brokerServiceUrlTls` has not been set.
@harshithasudhakar Please add the following content to your PR description and select a checkbox:
|
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
Outdated
Show resolved
Hide resolved
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.
Could we use StringUtils.isEmpty(getServiceUrl()) && StringUtils.isEmpty(getServiceUrlTls()) to reduce the codes ?
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.
Could you add a test for this change?
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
Outdated
Show resolved
Hide resolved
Used StringUtils.isEmpty(getServiceUrl()) && StringUtils.isEmpty(getServiceUrlTls()) to reduce the codes
@poorbarcode I have made two testcases to make sure at least one URL is set. |
pulsar-common/src/test/java/org/apache/pulsar/common/policies/data/ClusterDataImplTest.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
Outdated
Show resolved
Hide resolved
Changes: 1. testUpdateClusterServiceUrl(): Tests API for updating cluster's Service URL, and checks if the retrieved serviceURL matches with it. 2. testUpdateClusterBrokerServiceUrl(): Tests API for updating cluster's Service Broker URL, and checks if the retrieved serviceBrokerURL matches with it.
@poorbarcode @Technoboy-
|
@poorbarcode @Technoboy- Hi, are there any other similar issues I can work on? |
The pr had no activity for 30 days, mark with Stale label. |
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
Outdated
Show resolved
Hide resolved
Please remove these useless imports. https://github.com/apache/pulsar/actions/runs/6242793194/job/16947265796?pr=20821 ![]() |
Sorry for the late response. I think you can try to fix the flaky tests, it can help you understand the related function more clearly. |
@Technoboy- Thank you for helping me out with this PR. Sure, I'll get started on identifying and addressing these tests and will certainly reach out for guidance when needed. If you have any specific resources or tips for getting started with this task, please do to share them. |
Hi, I'd like to fix the errors in this PR but I'm unable to find the log files for this. Can you help me out? How can I run the tests again? |
Fixes #5638
Main/Original Issue: apache#19866
Motivation
Modifications
Checking if
serviceUrl
,serviceUrlTls
,brokerServiceUrl
, orbrokerServiceUrlTls
are not null. Then proceeds to throwIllegalArgumentException
if either ofserviceUrl
,serviceUrlTls
orbrokerServiceUrl
,brokerServiceUrlTls
has not been set.Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete