-
Notifications
You must be signed in to change notification settings - Fork 1
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
FEAT: Add random port mapping. #10
Conversation
commit message μ€ν μμ΅λλ€. |
61cd7b7
to
cc9f6c5
Compare
static int getPort() { | ||
try (ServerSocket socket = new ServerSocket(0)) { | ||
socket.setReuseAddress(true); | ||
return socket.getLocalPort(); | ||
} catch (IOException e) { | ||
throw new RuntimeException("memcached node port exception.", e); | ||
} | ||
} | ||
|
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.
μ΄ λ‘μ§μ λ€λ₯Έ test-container ꡬν체μμλ μ¬μ©νλ λ‘μ§μΈκ°μ?
λ€λ₯Έ ꡬν체μμ ꡬνν λ νΌλ°μ€ λ§ν¬ μλμ?
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.
μ΄ λ‘μ§μ λ€λ₯Έ test-container ꡬν체μμλ μ¬μ©νλ λ‘μ§μΈκ°μ?
νμΈνμ§ λͺ»νμ΅λλ€. λ€λ§ μ PRκ³Ό ν
μ€νΈ 컨ν
μ΄λμ 맀ν λͺ¨λ
50000λ²λμμ μ£Όλ‘ μ΄λ€μ§λκ±Έ 보면 λμΌν λ°©μμ μ¬μ©νμ§ μλ μκ°λ©λλ€.
λ€λ₯Έ ꡬν체μμ ꡬνν λ νΌλ°μ€ λ§ν¬ μλμ?
λ€λ₯Έ ꡬν체μμ μ§μ λλ€ ν¬νΈ κ°μ λ¨Όμ κ°μ Έμ€λ ꡬνμ μ°Ύμ§ λͺ»νμ΅λλ€.
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.
Exception λ°μ μ μ΄λ»κ² μ²λ¦¬νλ κΆκΈνλλ°, λ νΌλ°μ€κ° μκ΅°μ.
Exceptionμ΄ λ°μνλ©΄ μ 곡ν κΈ°λ³Έ ν¬νΈλ₯Ό μ€μ νμ§ μμλ λ κΉμ?
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.
getPort() μ λ°μνλ μμΈμ
Containerλ₯Ό start() νμ¬ μ€μ λ‘ κ΅¬λν λ
λ°μν μ μλ ν¬νΈ μμΈ(port already use)μ λν μ²λ¦¬λ₯Ό
λμΌνκ² κ°μ Έκ°λκ² μΌκ΄μ μ΄λΌκ³ μκ°ν©λλ€.
port already use λ°μ μ μμΈλ
TestContainerλ¨μμ catch λμ΄ μ²λ¦¬λμ§ μκ³ μμ ν΄λμ€κΉμ§ throw λ©λλ€.
κ·Έλμ λ³λμ κΈ°λ³Έ ν¬νΈλ₯Ό μ¬μ©ν΄μ ν기보λ€λ
μμΈλ₯Ό λμ Έμ μ¬μ©μμκ² μλ €μ£Όλκ² μ’μ κ² κ°μ΅λλ€.
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.
redisμμ λλ€ ν¬νΈλ₯Ό μ΄λ»κ² 맀ννλμ§μ λν μ½λλ₯Ό μ°Ύμ 첨λΆν΄μ£Όμλ©΄ μ’κ² μ΅λλ€.
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.
redisμμ λλ€ ν¬νΈλ₯Ό μ΄λ»κ² 맀ννλμ§μ λν μ½λλ₯Ό μ°Ύμ 첨λΆν΄μ£Όμλ©΄ μ’κ² μ΅λλ€.
λ λμ€ ν
μ€νΈ 컨ν
μ΄λ λΌμ΄λΈλ¬λ¦¬λ test containerμμ μ 곡νλ κΈ°λ₯μ
ν΅ν΄ λλ€ ν¬νΈ 맀νμ νκ³ λ³λμ ꡬνμ νμ§ μμ΅λλ€.
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.
μ ν¬λ test containerμμ μ 곡νλ κΈ°λ₯μ μ¬μ©νκΈ΄ μ΄λ €μ΄κ°μ?
test container λ΄λΆμμλ λλ€ ν¬νΈλ₯Ό μ΄λ»κ² μ°Ύκ³ λ§€ννλμ?
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.
μμ κ°μ΄ λ³λλ‘ λ‘μ§ κ΅¬μ±ν μ΄μ λ μλμ κ°μ΅λλ€.
ν
μ€νΈ 컨ν
μ΄λμμλ 컨ν
μ΄λ μμ± μμ² ν, ν¬νΈλ₯Ό μμ±ν©λλ€.
κ·Έλμ 컨ν
μ΄λ κ°μ²΄κ° μμ± λ ν, ν¬νΈ μ 보λ₯Ό κ°μ Έμ¬ μ μμ΅λλ€.
νμ§λ§ μ ν¬λ 컨ν
μ΄λ κ°μ²΄ μμ± μ μ ν λΉλ ν¬νΈλ₯Ό μμμΌ
zkμ cache_server_mappingμ μ 보λ₯Ό λκ²¨μ€ μ μμ΅λλ€.
test container λ΄λΆμμλ λλ€ ν¬νΈλ₯Ό μ΄λ»κ² μ°Ύκ³ λ§€ννλμ?
μλ§ μ κ° μ νν λ°©μ(new ServerSocket(0)
μ¬μ©)μΌλ‘ μ°Ύμ κ² κ°λ€κ³ μκ°ν©λλ€.
μ§μ μ½λλ₯Ό μ°Ύμλ³΄λ €λλ° λ΄λΆ ꡬνμ΄ λ³΅μ‘ν΄μ μκ°μ λ€μ΄μ§ μμμ΅λλ€.
κ°λ€κ³ μκ°ν μ΄μ λ μ κ° κ΅¬νν λ°©μκ³Ό ν
μ€νΈ 컨ν
μ΄λμμ
ν λΉνλ ν¬νΈλ€μ λλΆλΆ 50000λ²λ 맀νμ΄ λκΈ° λλ¬Έμ
λλ€.
λν μμ κ°μ λ°©μμ΄ μλ°μμ κ°μ© ν¬νΈλ₯Ό μ°Ύμ λ μμ£Ό νμ©λλ€κ³ ν©λλ€.
cc9f6c5
to
336936b
Compare
@oliviarla |
리뷰 λΆνλλ €μ.. |
@brido4125 λ΄μΌ μ€μΌλ‘ 리뷰 μλ£νκ² μ΅λλ€!! |
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.
리뷰 μλ£μ λλ€.
src/main/java/com/jam2in/arcus/testcontainers/ArcusClusterContainer.java
Outdated
Show resolved
Hide resolved
static int getPort() { | ||
try (ServerSocket socket = new ServerSocket(0)) { | ||
socket.setReuseAddress(true); | ||
return socket.getLocalPort(); | ||
} catch (IOException e) { | ||
throw new RuntimeException("memcached node port exception.", e); | ||
} | ||
} | ||
|
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.
redisμμ λλ€ ν¬νΈλ₯Ό μ΄λ»κ² 맀ννλμ§μ λν μ½λλ₯Ό μ°Ύμ 첨λΆν΄μ£Όμλ©΄ μ’κ² μ΅λλ€.
src/main/java/com/jam2in/arcus/testcontainers/ArcusContainer.java
Outdated
Show resolved
Hide resolved
src/test/java/com/jam2in/arcus/testcontainers/ArcusClusterContainerTest.java
Show resolved
Hide resolved
src/test/java/com/jam2in/arcus/testcontainers/ArcusContainerPropsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/jam2in/arcus/testcontainers/ArcusContainerPropsTest.java
Outdated
Show resolved
Hide resolved
336936b
to
16fbaf5
Compare
π Related Issue
#6 (comment)
β¨οΈ What I did
κ³ μ λ ν¬νΈκ° μλ λλ€ ν¬νΈλ‘ μΊμ ν΄λ¬μ€ν°λ₯Ό ꡬλμν¬ μ μλλ‘ λ³κ²½νμμ΅λλ€.