Skip to content

Commit

Permalink
fix: cast_primitive data type (#354)
Browse files Browse the repository at this point in the history
* fix: cast_primitive data type

* ci: fix modern OS's docker compose version

ref: https://askubuntu.com/questions/1508129/docker-compose-giving-containerconfig-errors-after-update-today

* ci: adapt new docker compose naming

* make linter happy

---------

Co-authored-by: Wey Gu <weyl.gu@gmail.com>
  • Loading branch information
zhangweidev and wey-gu committed Jun 14, 2024
1 parent 6672e51 commit 5d562fb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ jobs:
run: pdm fmt-check
- name: Test with pytest
run: |
docker-compose -f tests/docker-compose.yaml up -d
docker compose -f tests/docker-compose.yaml up -d
sleep 20
pdm test
- name: Test SSL connection with pytest
run: |
enable_ssl=true docker-compose -f tests/docker-compose-ssl.yaml up -d
enable_ssl=true docker compose -f tests/docker-compose-ssl.yaml up -d
sleep 20
pdm test-ssl
- name: Upload Coverage to Codecov
Expand All @@ -101,7 +101,7 @@ jobs:
pip install prettytable pandas
- name: Setup containers
run: |
docker-compose -f tests/docker-compose.yaml up -d
docker compose -f tests/docker-compose.yaml up -d
sleep 20
- name: Test example
run: |
Expand Down
2 changes: 1 addition & 1 deletion nebula3/data/DataObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def _cast_primitive(raw_value):
return {k: _cast_primitive(v) for k, v in raw_value.as_map().items()}
elif _type == Value.TVAL:
return raw_value.as_time().get_local_time_str()
elif _type == Value.DTVAL:
elif _type == Value.DVAL:
return raw_value.as_date().__repr__()
elif _type == Value.DTVAL:
return raw_value.as_datetime().get_local_datetime_str()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_remove_invalid_connection():
assert pool.init(addresses, configs)

# turn down one server('127.0.0.1', 9669) so the connection to it is invalid
os.system("docker stop tests_graphd0_1")
os.system("docker stop tests_graphd0_1 || docker stop tests-graphd0-1")
time.sleep(3)

# get connection from the pool, we should be able to still get 30 connections even though one server is down
Expand All @@ -302,5 +302,5 @@ def test_remove_invalid_connection():
assert len(pool._connections[addresses[2]]) == 15

finally:
os.system("docker start tests_graphd0_1")
os.system("docker start tests_graphd0_1 || docker start tests-graphd0-1")
time.sleep(3)
12 changes: 8 additions & 4 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ def test_2_reconnect(self):
time.sleep(10)
for i in range(0, 5):
if i == 3:
os.system("docker stop tests_graphd0_1")
os.system("docker stop tests_graphd1_1")
os.system(
"docker stop tests_graphd0_1 || docker stop tests-graphd0-1"
)
os.system(
"docker stop tests_graphd1_1 || docker stop tests-graphd1-1"
)
time.sleep(3)
resp = session.execute("SHOW SESSIONS")
assert resp.is_succeeded(), resp.error_msg()
Expand All @@ -63,8 +67,8 @@ def test_2_reconnect(self):
except Exception as e:
assert False, e
finally:
os.system("docker start tests_graphd0_1")
os.system("docker start tests_graphd1_1")
os.system("docker start tests_graphd0_1 || docker start tests-graphd0-1")
os.system("docker start tests_graphd1_1 || docker start tests-graphd1-1")
time.sleep(2)

def test_3_session_context(self):
Expand Down

0 comments on commit 5d562fb

Please sign in to comment.