Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb54b0dd

Browse files
authored
Update TPC-DS tests.
Fix using virtual environment, avoid TPC-DS tests failing when fast query status could not be obtained.Travis CI: enable TPC-DS tests, allow tests to fail on unsupported versions.
2 parents35416b6 +7801aa1 commitb54b0dd

File tree

4 files changed

+53
-18
lines changed

4 files changed

+53
-18
lines changed

‎.travis.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,22 @@ notifications:
2222
on_failure:always
2323

2424
env:
25-
-PG_VERSION=16 LEVEL=hardcore USE_TPCDS=0
25+
-PG_VERSION=16 LEVEL=hardcore USE_TPCDS=1
2626
-PG_VERSION=16
27-
-PG_VERSION=15 LEVEL=hardcore USE_TPCDS=0
27+
-PG_VERSION=15 LEVEL=hardcore USE_TPCDS=1
2828
-PG_VERSION=15
29-
-PG_VERSION=14 LEVEL=hardcore USE_TPCDS=0
29+
-PG_VERSION=14 LEVEL=hardcore USE_TPCDS=1
3030
-PG_VERSION=14
31-
-PG_VERSION=13 LEVEL=hardcore USE_TPCDS=0
31+
-PG_VERSION=13 LEVEL=hardcore USE_TPCDS=1
3232
-PG_VERSION=13
33-
-PG_VERSION=12 LEVEL=hardcore USE_TPCDS=0
33+
-PG_VERSION=12 LEVEL=hardcore USE_TPCDS=1
3434
-PG_VERSION=12
35-
-PG_VERSION=11 LEVEL=hardcore USE_TPCDS=0
3635
-PG_VERSION=11
37-
-PG_VERSION=10 LEVEL=hardcore USE_TPCDS=0
3836
-PG_VERSION=10
39-
-PG_VERSION=9.6 LEVEL=hardcore
4037
-PG_VERSION=9.6
4138

4239
matrix:
4340
allow_failures:
44-
-env:PG_VERSION=10 LEVEL=nightmare
45-
-env:PG_VERSION=9.6 LEVEL=nightmare
41+
-env:PG_VERSION=11
42+
-env:PG_VERSION=10
43+
-env:PG_VERSION=9.6

‎run_tests.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
set -ux
1414
status=0
1515

16+
venv_path=tmp/env
17+
rm -rf"$venv_path"
18+
1619
# global exports
1720
export PGPORT=55435
1821
export VIRTUAL_ENV_DISABLE_PROMPT=1
@@ -148,13 +151,14 @@ if [ -f regression.diffs ]; then cat regression.diffs; fi
148151

149152
# run python tests
150153
set +x -e
151-
python3 -m venv /tmp/env&&source /tmp/env/bin/activate&&
152-
pip install -r ./tests/requirements.txt
154+
python3 -m venv"$venv_path"&&source"$venv_path/bin/activate"
155+
pip3 install --upgrade -t"$venv_path" -r ./tests/requirements.txt
156+
#pip3 install -e "./$venv_path"
153157
set -e#exit virtualenv with error code
154-
python tests/pg_qs_test_runner.py --port$PGPORT
158+
python3 tests/pg_qs_test_runner.py --port$PGPORT
155159
if [["$USE_TPCDS"=="1" ]];then
156-
python tests/pg_qs_test_runner.py --port$PGPORT --tpc-ds-setup
157-
python tests/pg_qs_test_runner.py --port$PGPORT --tpc-ds-run
160+
python3 tests/pg_qs_test_runner.py --port$PGPORT --tpc-ds-setup
161+
python3 tests/pg_qs_test_runner.py --port$PGPORT --tpc-ds-run
158162
fi
159163
deactivate
160164
set -x
@@ -179,4 +183,5 @@ gcov $CUSTOM_PG_SRC/contrib/pg_query_state/*.c $CUSTOM_PG_SRC/contrib/pg_query_s
179183
set +ux
180184

181185
# send coverage stats to Codecov
186+
export CODECOV_TOKEN=55ab7421-9277-45af-a329-d8b40db96b2a
182187
bash<(curl -s https://codecov.io/bash)

‎tests/pg_qs_test_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
importos
99
importsys
1010

11+
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
12+
sys.path.append(os.path.abspath('tmp/env'))
13+
1114
importpsycopg2
1215

13-
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
1416
fromtest_casesimport*
1517
importtpcds
1618

‎tests/tpcds.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
importtime
99

1010
importprogressbar
11+
# This actually imports progressbar2 but `import progressbar2' itself doesn't work.
12+
# In case of problems with the progressbar/progressbar2, check that you have the
13+
# progressbar2 installed and the path to it or venv is specified.
14+
1115
importpsycopg2.extensions
1216

1317
importcommon
@@ -22,7 +26,10 @@ def setup_tpcds(config):
2226
try:
2327
conn=psycopg2.connect(**config)
2428
cur=conn.cursor()
29+
exceptExceptionase:
30+
raiseDataLoadException('Load failed: %s'%e)
2531

32+
try:
2633
# Create pg_query_state extension
2734
cur.execute('CREATE EXTENSION IF NOT EXISTS pg_query_state')
2835

@@ -55,13 +62,13 @@ def run_tpcds(config):
5562
TPC_DS_STATEMENT_TIMEOUT=20000# statement_timeout in ms
5663

5764
print('Preparing TPC-DS queries...')
65+
err_count=0
5866
queries= []
5967
forquery_fileinsorted(os.listdir('tmp_stress/tpcds-result-reproduction/query_qualification/')):
6068
withopen('tmp_stress/tpcds-result-reproduction/query_qualification/%s'%query_file,'r')asf:
6169
queries.append(f.read())
6270

6371
acon,=common.n_async_connect(config)
64-
pid=acon.get_backend_pid()
6572

6673
print('Starting TPC-DS queries...')
6774
timeout_list= []
@@ -84,8 +91,25 @@ def run_tpcds(config):
8491
PG_QS_DELAY,BEFORE_GETTING_QS_DELAY=0.1,0.1
8592
BEFORE_GETTING_QS,GETTING_QS=range(2)
8693
state,n_first_getting_qs_retries=BEFORE_GETTING_QS,0
94+
95+
pg_qs_args= {
96+
'config':config,
97+
'pid':acon.get_backend_pid()
98+
}
99+
87100
whileTrue:
88-
result,notices=common.pg_query_state(config,pid)
101+
try:
102+
result,notices=common.pg_query_state(**pg_qs_args)
103+
exceptExceptionase:
104+
# do not consider the test failed if the "error in message
105+
# queue data transmitting" is received, this may happen with
106+
# some small probability, but if it happens too often it is
107+
# a problem, we will handle this case after the loop
108+
if"error in message queue data transmitting"ine.pgerror:
109+
err_count+=1
110+
else:
111+
raisee
112+
89113
# run state machine to determine the first getting of query state
90114
# and query finishing
91115
ifstate==BEFORE_GETTING_QS:
@@ -109,6 +133,12 @@ def run_tpcds(config):
109133
exceptpsycopg2.extensions.QueryCanceledError:
110134
timeout_list.append(i+1)
111135

136+
iferr_count>2:
137+
print("\nERROR: error in message queue data transmitting")
138+
raiseException('error was received %d times'%err_count)
139+
eliferr_count>0:
140+
print(err_count," times there was error in message queue data transmitting")
141+
112142
common.n_close((acon,))
113143

114144
iflen(timeout_list)>0:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp