Skip to content

Commit

Permalink
add version whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
javaGitHub2022 committed Jan 8, 2024
1 parent 7bec002 commit 6cffd71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nebula3/gclient/net/SessionPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _new_session(self):
except AuthFailedException as e:
# if auth failed because of credentials, close the pool
if e.message.find("Invalid password") or e.message.find(
"User not exist"
"User not exist"
):
logger.error(
'Authentication failed, because of bad credentials, close the pool {}'.format(
Expand Down
9 changes: 5 additions & 4 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@

AddrIp = ['127.0.0.1']
port = 9669
handshakeKey="3.0.0"
handshakeKey = "3.0.0"


class TestConnection(TestCase):
def test_create(self):
for ip in AddrIp:
try:
conn = Connection()
conn.open(ip, port, 1000,handshakeKey)
conn.open(ip, port, 1000, handshakeKey)
auth_result = conn.authenticate('root', 'nebula')
assert auth_result.get_session_id() != 0
conn.close()
Expand All @@ -39,7 +40,7 @@ def test_release(self):
for ip in AddrIp:
try:
conn = Connection()
conn.open(ip, port, 1000,handshakeKey)
conn.open(ip, port, 1000, handshakeKey)
auth_result = conn.authenticate('root', 'nebula')
session_id = auth_result.get_session_id()
assert session_id != 0
Expand All @@ -57,7 +58,7 @@ def test_release(self):
def test_close(self):
for ip in AddrIp:
conn = Connection()
conn.open(ip, port, 1000,handshakeKey)
conn.open(ip, port, 1000, handshakeKey)
auth_result = conn.authenticate('root', 'nebula')
assert auth_result.get_session_id() != 0
conn.close()
Expand Down
5 changes: 3 additions & 2 deletions tests/test_ssl_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@
port = 9669
handshakeKey = "3.0.0"


@pytest.mark.SSL
class TestSSLConnection(TestCase):
def test_create(self):
try:
conn = Connection()
conn.open_SSL(host, port, 1000, handshakeKey,ssl_config)
conn.open_SSL(host, port, 1000, handshakeKey, ssl_config)
auth_result = conn.authenticate('root', 'nebula')
assert auth_result.get_session_id() != 0
conn.close()
Expand All @@ -54,7 +55,7 @@ def test_create(self):

try:
conn = Connection()
conn.open_SSL(host, port, 1000,handshakeKey, ssl_config)
conn.open_SSL(host, port, 1000, handshakeKey, ssl_config)
auth_result = conn.authenticate('root', 'nebula')
session_id = auth_result.get_session_id()
assert session_id != 0
Expand Down

0 comments on commit 6cffd71

Please sign in to comment.