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

Commit80a5e1a

Browse files
committed
Segregate stress test based on TPC-DS from common ones
1 parent4d4734a commit80a5e1a

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

‎.travis.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ notifications:
1818
on_failure:always
1919

2020
env:
21-
-PG_VERSION=12 LEVEL=hardcore
21+
-PG_VERSION=12 LEVEL=hardcore USE_TPCDS=1
2222
-PG_VERSION=12
23-
-PG_VERSION=11 LEVEL=hardcore
23+
-PG_VERSION=11 LEVEL=hardcore USE_TPCDS=1
2424
-PG_VERSION=11
25-
-PG_VERSION=10 LEVEL=hardcore
25+
-PG_VERSION=10 LEVEL=hardcore USE_TPCDS=1
2626
-PG_VERSION=10
27-
-PG_VERSION=9.6 LEVEL=hardcore
27+
-PG_VERSION=9.6 LEVEL=hardcore USE_TPCDS=1
2828
-PG_VERSION=9.6
29-
-PG_VERSION=12 LEVEL=stress
30-
-PG_VERSION=11 LEVEL=stress
31-
-PG_VERSION=10 LEVEL=stress
3229

3330
matrix:
3431
allow_failures:

‎README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ python tests/pg_qs_test_runner.py [OPTION]...
4747
**- -database* --- database name, default value is*postgres*
4848
**- -user* --- user name, default value is*postgres*
4949
**- -password* --- user's password, default value is empty
50+
**- -tpc-ds* --- runs only stress tests on TPC-DS benchmark
5051

5152
Or run all tests in`Docker` using:
5253

5354
```shell
54-
export LEVEL=stress
55+
export LEVEL=hardcore
56+
export USE_TPCDS=1
5557
export PG_VERSION=12
5658

5759
docker-compose build

‎run_tests.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ python3 -m venv /tmp/env && source /tmp/env/bin/activate &&
147147
pip install -r tests/requirements.txt
148148
set -e#exit virtualenv with error code
149149
python tests/pg_qs_test_runner.py --port$PGPORT
150+
if [-n$USE_TPCDS ];then
151+
python tests/pg_qs_test_runner.py --port$PGPORT --tpc-ds
152+
fi
150153
deactivate
151154
set -x
152155

@@ -170,4 +173,4 @@ gcov *.c *.h
170173
set +ux
171174

172175
# send coverage stats to Codecov
173-
bash<(curl -s https://codecov.io/bash)
176+
bash<(curl -s https://codecov.io/bash)

‎tests/pg_qs_test_runner.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TeardownException(Exception): pass
3232
'insert into bar select i, i%2=1 from generate_series(1, 500000) as i',
3333
'analyze foo',
3434
'analyze bar',
35-
]
35+
]
3636

3737
teardown_cmd= [
3838
'drop table foo cascade',
@@ -82,27 +82,30 @@ def teardown(con):
8282

8383
defmain(config):
8484
''' Main test function '''
85+
conn_params= {
86+
key:config.__dict__[key]forkeyin ('host','port','user','database','password')
87+
}
8588

86-
con=psycopg2.connect(**config)
87-
setup(con)
89+
ifconfig.use_tpcds:
90+
print('Starting stress test')
91+
test_tpc_ds(conn_params)
92+
print('Stress finished successfully')
93+
return
8894

95+
# run default tests
96+
init_conn=psycopg2.connect(**conn_params)
97+
setup(init_conn)
8998
fori,testinenumerate(tests):
9099
iftest.__doc__:
91100
descr=test.__doc__
92101
else:
93102
descr='test case %d'% (i+1)
94103
print(("%s..."%descr))
95104
sys.stdout.flush()
96-
test(config)
105+
test(conn_params)
97106
print('ok!')
98-
99-
ifos.environ['LEVEL']=='stress':
100-
print('Starting stress test')
101-
test_tpc_ds(config)
102-
print('Stress finished successfully')
103-
104-
teardown(con)
105-
con.close()
107+
teardown(init_conn)
108+
init_conn.close()
106109

107110
if__name__=='__main__':
108111
parser=argparse.ArgumentParser(description='Query state of running backends tests')
@@ -111,7 +114,8 @@ def main(config):
111114
parser.add_argument('--port',type=int,default=5432,help='postgres server port')
112115
parser.add_argument('--user',dest='user',default='postgres',help='user name')
113116
parser.add_argument('--database',dest='database',default='postgres',help='database name')
114-
parser.add_argument('--password',dest='password',nargs=0,action=PasswordPromptAction,default='')
117+
parser.add_argument('--password',dest='password',nargs=0,action=PasswordPromptAction,default='',help='password')
118+
parser.add_argument('--tpc-ds',dest='use_tpcds',action='store_true',help='run only stress test based on TPC-DS benchmark')
115119

116120
args=parser.parse_args()
117-
main(args.__dict__)
121+
main(args)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp