-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathtest_list.py
111 lines (89 loc) · 4.22 KB
/
test_list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import asyncio
import functools
import random
import time
from testing import Client
from testing import default_test_setup
from testing import gen_data
from testing import gen_points
from testing import gen_series
from testing import InsertError
from testing import PoolError
from testing import QueryError
from testing import run_test
from testing import Series
from testing import Server
from testing import ServerError
from testing import SiriDB
from testing import TestBase
from testing import UserAuthError
from testing import parse_args
TIME_PRECISION = 's'
class TestList(TestBase):
title = 'Test list'
GEN_POINTS = functools.partial(
gen_points, n=1, time_precision=TIME_PRECISION)
@default_test_setup(1, time_precision=TIME_PRECISION)
async def run(self):
await self.client0.connect()
# Create some random series and start 25 insert task parallel
series = gen_series(n=10000)
tasks = [
asyncio.ensure_future(
self.client0.insert_some_series(
series,
timeout=0,
points=self.GEN_POINTS))
for i in range(25)]
await asyncio.gather(*tasks)
await self.client0.query('list series /.*/ - /.*/')
await self.client0.query('list series /.*/ | /.*/')
await self.client0.query('list series /.*/ & /.*/')
await self.client0.query('list series /.*/ ^ /.*/')
await self.client0.query('list series /.*/ - /a.*/')
await self.client0.query('list series /.*/ | /a.*/')
await self.client0.query('list series /.*/ & /a.*/')
await self.client0.query('list series /.*/ ^ /a.*/')
await self.client0.query('list series /.*/ - /a.*/ | /b.*/')
await self.client0.query('list series /.*/ | /a.*/ | /b.*/')
await self.client0.query('list series /.*/ & /a.*/ | /b.*/')
await self.client0.query('list series /.*/ ^ /a.*/ | /b.*/')
await self.client0.query('list series /.*/ - /a.*/ | /.*/')
await self.client0.query('list series /.*/ | /a.*/ | /.*/')
await self.client0.query('list series /.*/ & /a.*/ | /.*/')
await self.client0.query('list series /.*/ ^ /a.*/ | /.*/')
await self.client0.query('list series /.*/ - /a.*/ - /b.*/')
await self.client0.query('list series /.*/ | /a.*/ - /b.*/')
await self.client0.query('list series /.*/ & /a.*/ - /b.*/')
await self.client0.query('list series /.*/ ^ /a.*/ - /b.*/')
await self.client0.query('list series /.*/ - /a.*/ - /.*/')
await self.client0.query('list series /.*/ | /a.*/ - /.*/')
await self.client0.query('list series /.*/ & /a.*/ - /.*/')
await self.client0.query('list series /.*/ ^ /a.*/ - /.*/')
await self.client0.query('list series /.*/ - /a.*/ & /b.*/')
await self.client0.query('list series /.*/ | /a.*/ & /b.*/')
await self.client0.query('list series /.*/ & /a.*/ & /b.*/')
await self.client0.query('list series /.*/ ^ /a.*/ & /b.*/')
await self.client0.query('list series /.*/ - /a.*/ & /.*/')
await self.client0.query('list series /.*/ | /a.*/ & /.*/')
await self.client0.query('list series /.*/ & /a.*/ & /.*/')
await self.client0.query('list series /.*/ ^ /a.*/ & /.*/')
await self.client0.query('list series /.*/ - /a.*/ ^ /b.*/')
await self.client0.query('list series /.*/ | /a.*/ ^ /b.*/')
await self.client0.query('list series /.*/ & /a.*/ ^ /b.*/')
await self.client0.query('list series /.*/ ^ /a.*/ ^ /b.*/')
await self.client0.query('list series /.*/ - /a.*/ ^ /.*/')
await self.client0.query('list series /.*/ | /a.*/ ^ /.*/')
await self.client0.query('list series /.*/ & /a.*/ ^ /.*/')
await self.client0.query('list series /.*/ ^ /a.*/ ^ /.*/')
await self.client0.query('alter database set list_limit 5000')
with self.assertRaisesRegex(
QueryError,
'Limit must be a value between 1 and 5000 '
'but received: 6000.*'):
await self.client0.query(
'list series limit 6000')
self.client0.close()
if __name__ == '__main__':
parse_args()
run_test(TestList())