Skip to content

Commit 17d1d16

Browse files
authored
Ci/issue 20 action workflow (#53)
* Update CI workflow * Enable test
1 parent 6c83c35 commit 17d1d16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+660
-697
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,39 @@ on:
99
name: test
1010
jobs:
1111
tests:
12-
if: ${{ false }}
12+
if: ${{ github.event.action != 'closed' || github.event.pull_request.merged == true }}
1313
runs-on: ubuntu-20.04
1414
strategy:
1515
matrix:
1616
use-numpy:
1717
- 0
1818
python-version:
19-
- "3.5"
19+
# - "3.5" ,In this old version, example have a syntax error:E999
2020
- "3.6"
2121
- "3.7"
2222
- "3.8"
2323
- "3.9"
2424
- "3.10"
2525
- "3.11"
2626
- "3.12"
27+
- "3.13"
2728
- "pypy-3.6"
2829
- "pypy-3.7"
30+
- "pypy-3.8"
31+
- "pypy-3.9"
32+
- "pypy-3.10"
2933
proton-version:
3034
- "latest"
3135
include:
3236
- proton-version: "latest"
33-
use-numpy: 1
3437
python-version: "3.8"
38+
use-numpy: 1
3539

3640
name: ${{ matrix.python-version }} PROTON=${{ matrix.proton-version }} NUMPY=${{ matrix.use-numpy }}
3741
steps:
38-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v4
3943
- name: Set up Python
40-
uses: actions/setup-python@v2
44+
uses: actions/setup-python@v5
4145
with:
4246
python-version: ${{ matrix.python-version }}
4347
architecture: x64
@@ -56,11 +60,11 @@ jobs:
5660
run: |
5761
echo "VERSION=${{ matrix.proton-version }}" > tests/.env
5862
echo "ORG=timeplus" >> tests/.env
59-
docker-compose -f tests/docker-compose.yml up -d
63+
docker compose -f tests/docker-compose.yml up -d
6064
- name: Setup proton-client proxy for docker
6165
run: |
6266
# Faking proton-client real communication with container via docker exec.
63-
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-proton-client proton client "$@"' | sudo tee /usr/local/bin/proton-client > /dev/null
67+
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-proton-client timeplusd client "$@"' | sudo tee /usr/local/bin/proton-client > /dev/null
6468
sudo chmod +x /usr/local/bin/proton-client
6569
# Overriding setup.cfg. Set host=proton-server
6670
sed -i 's/^host=localhost$/host=proton-server/' setup.cfg
@@ -81,15 +85,15 @@ jobs:
8185
env:
8286
USE_NUMPY: ${{ matrix.use-numpy }}
8387
- name: Run tests
84-
run: coverage run -m py.test --timeout=10 -v
88+
run: coverage run -m pytest --timeout=10 -v
8589
timeout-minutes: 5
8690
env:
8791
# Set initial TZ for docker exec -e "`env | grep ^TZ`"
8892
TZ: UTC
8993
- name: Upload coverage
9094
run: coveralls
9195
env:
92-
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9397
COVERALLS_PARALLEL: true
9498
COVERALLS_FLAG_NAME: ${{ matrix.python-version }} CH=${{ matrix.proton-version }} NUMPY=${{ matrix.use-numpy }}
9599

@@ -99,19 +103,19 @@ jobs:
99103
runs-on: ubuntu-latest
100104
steps:
101105
- name: Finished
102-
uses: coverallsapp/github-action@1.1.3
106+
uses: coverallsapp/github-action@v2.3.0
103107
with:
104-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
108+
github-token: ${{ secrets.GITHUB_TOKEN }}
105109
parallel-finished: true
106110

107111
valgrind:
108112
name: Valgrind check
109113
needs: tests
110114
runs-on: ubuntu-20.04
111115
steps:
112-
- uses: actions/checkout@v2
116+
- uses: actions/checkout@v4
113117
- name: Set up Python
114-
uses: actions/setup-python@v2
118+
uses: actions/setup-python@v5
115119
with:
116120
python-version: 3.8
117121
architecture: x64
@@ -126,13 +130,13 @@ jobs:
126130
run: |
127131
echo "VERSION=$VERSION" > tests/.env
128132
echo "ORG=timeplus" >> tests/.env
129-
docker-compose -f tests/docker-compose.yml up -d
133+
docker compose -f tests/docker-compose.yml up -d
130134
env:
131135
VERSION: latest
132136
- name: Setup proton-client proxy for docker
133137
run: |
134138
# Faking proton-client real communication with container via docker exec.
135-
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-proton-client proton-client "$@"' | sudo tee /usr/local/bin/proton-client > /dev/null
139+
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-proton-client timeplusd client "$@"' | sudo tee /usr/local/bin/proton-client > /dev/null
136140
sudo chmod +x /usr/local/bin/proton-client
137141
# Overriding setup.cfg. Set host=proton-server
138142
sed -i 's/^host=localhost$/host=proton-server/' setup.cfg
@@ -145,9 +149,9 @@ jobs:
145149
env:
146150
USE_NUMPY: 1
147151
- name: Run tests under valgrind
148-
run: valgrind --error-exitcode=1 --suppressions=valgrind.supp py.test -v
152+
run: valgrind --error-exitcode=1 --suppressions=valgrind.supp pytest -v
149153
env:
150154
# Set initial TZ for docker exec -e "`env | grep ^TZ`"
151155
TZ: UTC
152156
USE_NUMPY: 1
153-
PYTHONMALLOC: malloc
157+
PYTHONMALLOC: malloc

tests/columns/test_array.py

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
from tests.testcase import BaseTestCase
44
from proton_driver import errors
5-
from tests.util import require_server_version
65

76

8-
class ArrayTestCase(BaseTestCase):
7+
class arrayTestCase(BaseTestCase):
98
def test_empty(self):
10-
columns = 'a Array(Int32)'
9+
columns = 'a array(int32)'
1110

1211
data = [([], )]
13-
with self.create_table(columns):
12+
with self.create_stream(columns):
1413
self.client.execute(
1514
'INSERT INTO test (a) VALUES', data
1615
)
@@ -25,10 +24,10 @@ def test_empty(self):
2524
self.assertEqual(inserted, data)
2625

2726
def test_simple(self):
28-
columns = 'a Array(Int32)'
27+
columns = 'a array(int32)'
2928
data = [([100, 500], )]
3029

31-
with self.create_table(columns):
30+
with self.create_stream(columns):
3231
self.client.execute(
3332
'INSERT INTO test (a) VALUES', data
3433
)
@@ -43,10 +42,10 @@ def test_simple(self):
4342
self.assertEqual(inserted, data)
4443

4544
def test_write_column_as_nested_array(self):
46-
columns = 'a Array(Int32)'
45+
columns = 'a array(int32)'
4746
data = [([100, 500], ), ([100, 500], )]
4847

49-
with self.create_table(columns):
48+
with self.create_stream(columns):
5049
self.client.execute(
5150
'INSERT INTO test (a) VALUES', data
5251
)
@@ -61,10 +60,10 @@ def test_write_column_as_nested_array(self):
6160
self.assertEqual(inserted, data)
6261

6362
def test_nested_with_enum(self):
64-
columns = "a Array(Array(Enum8('hello' = -1, 'world' = 2)))"
63+
columns = "a array(array(enum8('hello' = -1, 'world' = 2)))"
6564

6665
data = [([['hello', 'world'], ['hello']], )]
67-
with self.create_table(columns):
66+
with self.create_stream(columns):
6867
self.client.execute(
6968
'INSERT INTO test (a) VALUES', data
7069
)
@@ -79,7 +78,7 @@ def test_nested_with_enum(self):
7978
self.assertEqual(inserted, data)
8079

8180
def test_nested_of_nested(self):
82-
columns = 'a Array(Array(Array(Int32))), b Array(Array(Array(Int32)))'
81+
columns = 'a array(array(array(int32))), b array(array(array(int32)))'
8382
data = [([
8483
[[255, 170], [127, 127, 127, 127, 127], [170, 170, 170], [170]],
8584
[[255, 255, 255], [255]], [[255], [255], [255]]
@@ -88,7 +87,7 @@ def test_nested_of_nested(self):
8887
[[255, 255, 255], [255]], [[255], [255], [255]]
8988
])]
9089

91-
with self.create_table(columns):
90+
with self.create_stream(columns):
9291
self.client.execute(
9392
'INSERT INTO test (a, b) VALUES', data
9493
)
@@ -107,12 +106,12 @@ def test_nested_of_nested(self):
107106
self.assertEqual(inserted, data)
108107

109108
def test_multidimensional(self):
110-
columns = "a Array(Array(Array(Nullable(String))))"
109+
columns = "a array(array(array(nullable(string))))"
111110
data = [([[['str1_1', 'str1_2', None], [None]],
112111
[['str1_3', 'str1_4', None], [None]]], ),
113112
([[['str2_1', 'str2_2', None], [None]]], ),
114113
([[['str3_1', 'str3_2', None], [None]]],)]
115-
with self.create_table(columns):
114+
with self.create_stream(columns):
116115
self.client.execute(
117116
'INSERT INTO test (a) VALUES', data
118117
)
@@ -131,12 +130,12 @@ def test_multidimensional(self):
131130
self.assertEqual(inserted, data)
132131

133132
def test_empty_nested(self):
134-
columns = "a Array(Array(Array(Int32))), b Array(Array(Array(Int32)))"
133+
columns = "a array(array(array(int32))), b array(array(array(int32)))"
135134
data = [
136135
([], [[]],),
137136
]
138137

139-
with self.create_table(columns):
138+
with self.create_stream(columns):
140139
self.client.execute("INSERT INTO test (a, b) VALUES", data)
141140

142141
query = "SELECT * FROM test"
@@ -149,24 +148,24 @@ def test_empty_nested(self):
149148
self.assertEqual(inserted, data)
150149

151150
def test_type_mismatch_error(self):
152-
columns = 'a Array(Int32)'
151+
columns = 'a array(int32)'
153152
data = [('test', )]
154153

155-
with self.create_table(columns):
154+
with self.create_stream(columns):
156155
with self.assertRaises(errors.TypeMismatchError):
157156
self.client.execute('INSERT INTO test (a) VALUES', data)
158157

159158
data = [(['test'], )]
160159

161-
with self.create_table(columns):
160+
with self.create_stream(columns):
162161
with self.assertRaises(errors.TypeMismatchError):
163162
self.client.execute('INSERT INTO test (a) VALUES', data)
164163

165164
def test_string_array(self):
166-
columns = 'a Array(String)'
165+
columns = 'a array(string)'
167166
data = [(['aaa', 'bbb'], )]
168167

169-
with self.create_table(columns):
168+
with self.create_stream(columns):
170169
self.client.execute(
171170
'INSERT INTO test (a) VALUES', data
172171
)
@@ -181,10 +180,10 @@ def test_string_array(self):
181180
self.assertEqual(inserted, data)
182181

183182
def test_string_nullable_array(self):
184-
columns = 'a Array(Nullable(String))'
183+
columns = 'a array(nullable(string))'
185184
data = [(['aaa', None, 'bbb'], )]
186185

187-
with self.create_table(columns):
186+
with self.create_stream(columns):
188187
self.client.execute(
189188
'INSERT INTO test (a) VALUES', data
190189
)
@@ -199,13 +198,13 @@ def test_string_nullable_array(self):
199198
self.assertEqual(inserted, data)
200199

201200
def test_uuid_array(self):
202-
columns = 'a Array(UUID)'
201+
columns = 'a array(uuid)'
203202
data = [([
204203
UUID('c0fcbba9-0752-44ed-a5d6-4dfb4342b89d'),
205204
UUID('2efcead4-ff55-4db5-bdb4-6b36a308d8e0')
206205
], )]
207206

208-
with self.create_table(columns):
207+
with self.create_stream(columns):
209208
self.client.execute(
210209
'INSERT INTO test (a) VALUES', data
211210
)
@@ -222,14 +221,14 @@ def test_uuid_array(self):
222221
self.assertEqual(inserted, data)
223222

224223
def test_uuid_nullable_array(self):
225-
columns = 'a Array(Nullable(UUID))'
224+
columns = 'a array(nullable(uuid))'
226225
data = [([
227226
UUID('c0fcbba9-0752-44ed-a5d6-4dfb4342b89d'),
228227
None,
229228
UUID('2efcead4-ff55-4db5-bdb4-6b36a308d8e0')
230229
], )]
231230

232-
with self.create_table(columns):
231+
with self.create_stream(columns):
233232
self.client.execute(
234233
'INSERT INTO test (a) VALUES', data
235234
)
@@ -246,12 +245,12 @@ def test_uuid_nullable_array(self):
246245
inserted = self.client.execute(query)
247246
self.assertEqual(inserted, data)
248247

249-
@require_server_version(19, 16, 13)
248+
# @require_server_version(19, 16, 13)
250249
def test_tuple_array(self):
251-
columns = 'a Array(Tuple(Int32))'
250+
columns = 'a array(tuple(int32))'
252251
data = [([], )]
253252

254-
with self.create_table(columns):
253+
with self.create_stream(columns):
255254
self.client.execute(
256255
'INSERT INTO test (a) VALUES', data
257256
)

tests/columns/test_bool.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44

55
class BoolTestCase(BaseTestCase):
6-
required_server_version = (21, 12)
6+
# required_server_version = (21, 12)
77

88
def test_simple(self):
9-
columns = ("a Bool")
9+
columns = ("a bool")
1010

1111
data = [(1,), (0,), (True,), (False,), (None,), ("False",), ("",)]
12-
with self.create_table(columns):
12+
with self.create_stream(columns):
1313
self.client.execute('INSERT INTO test (a) VALUES', data)
1414

1515
query = 'SELECT * FROM test'
@@ -40,19 +40,19 @@ def test_simple(self):
4040
)
4141

4242
def test_errors(self):
43-
columns = "a Bool"
44-
with self.create_table(columns):
43+
columns = "a bool"
44+
with self.create_stream(columns):
4545
with self.assertRaises(errors.TypeMismatchError):
4646
self.client.execute(
4747
'INSERT INTO test (a) VALUES', [(1, )],
4848
types_check=True
4949
)
5050

5151
def test_nullable(self):
52-
columns = "a Nullable(Bool)"
52+
columns = "a nullable(bool)"
5353

5454
data = [(None, ), (True, ), (False, )]
55-
with self.create_table(columns):
55+
with self.create_stream(columns):
5656
self.client.execute('INSERT INTO test (a) VALUES', data)
5757

5858
query = 'SELECT * FROM test'

tests/columns/test_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def send_data(*args, **kwargs):
1717
self.client.connection.send_data = send_data
1818

1919
def test_insert_block_size(self):
20-
with self.create_table('a UInt8'):
20+
with self.create_stream('a uint8'):
2121
data = [(x, ) for x in range(4)]
2222
self.client.execute(
2323
'INSERT INTO test (a) VALUES', data
@@ -33,7 +33,7 @@ def test_insert_block_size(self):
3333
self.assertEqual(inserted, data)
3434

3535
def test_columnar_insert_block_size(self):
36-
with self.create_table('a UInt8'):
36+
with self.create_stream('a uint8'):
3737
data = [(0, 1, 2, 3)]
3838
self.client.execute(
3939
'INSERT INTO test (a) VALUES', data, columnar=True

0 commit comments

Comments
 (0)