Skip to content
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

fix condition for KubePortManagerSingleton init twice #16213

Merged
merged 6 commits into from
Oct 11, 2022

Conversation

goodseeyou
Copy link
Contributor

@goodseeyou goodseeyou commented Sep 1, 2022

What

Fix condition to init KubePortManagerSingleton twice when given ports are the same.

How

make the condition align to the log message

Recommended reading order

airbyte-workers/src/main/java/io/airbyte/workers/process/KubePortManagerSingleton.java

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@CLAassistant
Copy link

CLAassistant commented Sep 1, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added area/platform issues related to the platform area/worker Related to worker labels Sep 1, 2022
@marcosmarxm
Copy link
Member

Can you sign the CLA @goodseeyou ?

@marcosmarxm
Copy link
Member

@davinchia can you check this contribution?

@goodseeyou
Copy link
Contributor Author

Hi @marcosmarxm I signed it

@davinchia
Copy link
Contributor

@goodseeyou can you explain the error case this logic change is catching? I want to make sure I understand what you are thinking.

We have pretty good test today in KubePodProcessIntegrationTest, can you add a test case there testing the situation you have in mind?

@@ -121,6 +119,31 @@ public void teardown() throws Exception {
server.stop();
}

@RetryingTest(3)
public void testInitKubePortManagerSingletonTwice() throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davinchia what I really add test here.

Others code change is coding-style formatter by google-style which recommends (https://github.com/airbytehq/airbyte/blob/master/docs/contributing-to-airbyte/code-style.md)

@@ -56,7 +56,7 @@ public static synchronized KubePortManagerSingleton getInstance() {
public static synchronized void init(final Set<Integer> ports) {
if (instance == null) {
instance = new KubePortManagerSingleton(ports);
} else if (Sets.intersection(instance.getAllPorts(), ports).size() != ports.size()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is what I really fix

@goodseeyou
Copy link
Contributor Author

local test successfully
Screen Shot 2022-09-16 at 00 22 38

@marcosmarxm
Copy link
Member

@davinchia can you check this PR?

@davinchia
Copy link
Contributor

@goodseeyou thank you!

Copy link
Contributor

@davinchia davinchia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goodseeyou two small spelling suggestions. After that, good to merge!

@goodseeyou
Copy link
Contributor Author

Hi @davinchia, I fixed the spelling by your suggestions.

@marcosmarxm
Copy link
Member

Sorry the delay here @goodseeyou I'll merge this on Monday.

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is building locally! Thanks @goodseeyou sorry the delay here.

jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* add test for init ports manager twice

* fix bug for init more then onece

* formatter

* fix typo by pr suggestions

Co-authored-by: Davin Chia <davinchia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/worker Related to worker community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants