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

Commit99eec6e

Browse files
author
vshepard
committed
Add s3 tests
1 parent2b9c9b1 commit99eec6e

File tree

55 files changed

+14440
-20634
lines changed

Some content is hidden

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

55 files changed

+14440
-20634
lines changed

‎tests/CVE_2018_1058_test.py

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
importos
22
importunittest
3-
from .helpers.ptrack_helpersimportProbackupTest,ProbackupException
3+
from .helpers.ptrack_helpersimportProbackupTest
44

5-
classCVE_2018_1058(ProbackupTest,unittest.TestCase):
5+
classCVE_2018_1058(ProbackupTest):
66

77
# @unittest.skip("skip")
88
deftest_basic_default_search_path(self):
99
""""""
10-
backup_dir=os.path.join(self.tmp_path,self.module_name,self.fname,'backup')
11-
node=self.make_simple_node(
12-
base_dir=os.path.join(self.module_name,self.fname,'node'),
13-
set_replication=True)
10+
node=self.pg_node.make_simple('node',checksum=False,set_replication=True)
1411

15-
self.init_pb(backup_dir)
16-
self.add_instance(backup_dir,'node',node)
12+
self.pb.init()
13+
self.pb.add_instance('node',node)
1714
node.slow_start()
1815

1916
node.safe_psql(
@@ -26,19 +23,16 @@ def test_basic_default_search_path(self):
2623
"END "
2724
"$$ LANGUAGE plpgsql")
2825

29-
self.backup_node(backup_dir,'node',node,backup_type='full',options=['--stream'])
26+
self.pb.backup_node('node',node,backup_type='full',options=['--stream'])
3027

3128
# @unittest.skip("skip")
3229
deftest_basic_backup_modified_search_path(self):
3330
""""""
34-
backup_dir=os.path.join(self.tmp_path,self.module_name,self.fname,'backup')
35-
node=self.make_simple_node(
36-
base_dir=os.path.join(self.module_name,self.fname,'node'),
37-
set_replication=True)
38-
self.set_auto_conf(node,options={'search_path':'public,pg_catalog'})
31+
node=self.pg_node.make_simple('node',checksum=False,set_replication=True)
32+
node.set_auto_conf(options={'search_path':'public,pg_catalog'})
3933

40-
self.init_pb(backup_dir)
41-
self.add_instance(backup_dir,'node',node)
34+
self.pb.init()
35+
self.pb.add_instance('node',node)
4236
node.slow_start()
4337

4438
node.safe_psql(
@@ -62,7 +56,7 @@ def test_basic_backup_modified_search_path(self):
6256
"$$ LANGUAGE plpgsql; "
6357
"CREATE VIEW public.pg_proc AS SELECT proname FROM public.pg_proc()")
6458

65-
self.backup_node(backup_dir,'node',node,backup_type='full',options=['--stream'])
59+
self.pb.backup_node('node',node,backup_type='full',options=['--stream'])
6660

6761
log_file=os.path.join(node.logs_dir,'postgresql.log')
6862
withopen(log_file,'r')asf:
@@ -73,10 +67,8 @@ def test_basic_backup_modified_search_path(self):
7367
# @unittest.skip("skip")
7468
deftest_basic_checkdb_modified_search_path(self):
7569
""""""
76-
node=self.make_simple_node(
77-
base_dir=os.path.join(self.module_name,self.fname,'node'),
78-
initdb_params=['--data-checksums'])
79-
self.set_auto_conf(node,options={'search_path':'public,pg_catalog'})
70+
node=self.pg_node.make_simple('node')
71+
node.set_auto_conf(options={'search_path':'public,pg_catalog'})
8072
node.slow_start()
8173

8274
node.safe_psql(
@@ -110,20 +102,11 @@ def test_basic_checkdb_modified_search_path(self):
110102
"CREATE VIEW public.pg_namespace AS SELECT * FROM public.pg_namespace();"
111103
)
112104

113-
try:
114-
self.checkdb_node(
105+
self.pb.checkdb_node(
115106
options=[
116107
'--amcheck',
117108
'--skip-block-validation',
118-
'-d','postgres','-p',str(node.port)])
119-
self.assertEqual(
120-
1,0,
121-
"Expecting Error because amcheck{,_next} not installed\n"
122-
" Output: {0}\n CMD: {1}".format(
123-
repr(self.output),self.cmd))
124-
exceptProbackupExceptionase:
125-
self.assertIn(
126-
"WARNING: Extension 'amcheck' or 'amcheck_next' are not installed in database postgres",
127-
e.message,
128-
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
129-
repr(e.message),self.cmd))
109+
'-d','postgres','-p',str(node.port)],
110+
expect_error="because amcheck{,_next} not installed")
111+
self.assertMessage(contains=
112+
"WARNING: Extension 'amcheck' or 'amcheck_next' are not installed in database postgres")

‎tests/Readme.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,22 @@ Run long (time consuming) tests:
4545
export PG_PROBACKUP_LONG=ON
4646
4747
Usage:
48-
sudo echo 0 > /proc/sys/kernel/yama/ptrace_scope
48+
49+
sudo sysctl kernel.yama.ptrace_scope=0 # only active until the next reboot
50+
or
51+
sudo sed -i 's/ptrace_scope = 1/ptrace_scope = 0/' /etc/sysctl.d/10-ptrace.conf # set permanently, needs a reboot to take effect
52+
# see https://www.kernel.org/doc/Documentation/security/Yama.txt for possible implications of setting this parameter permanently
4953
pip install testgres
5054
export PG_CONFIG=/path/to/pg_config
5155
python -m unittest [-v] tests[.specific_module][.class.test]
5256
```
53-
57+
#Environment variables
58+
| Variable| Possible values| Required| Default value| Description|
59+
| -|------------------------------------| -| -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
60+
| KEEP_LOGS| Any| No| Not set| If this variable is set to '1', 'y' or 'Y' then test logs are kept after the successful execution of a test, otherwise test logs are deleted upon the successful execution of a test|
61+
| PG_PROBACKUP_S3_TEST| Not set, minio, VK| No| Not set| If set, specifies the type of the S3 storage for the tests, otherwise signifies to the tests that the storage is not an S3 one|
62+
| PG_PROBACKUP_S3_CONFIG_FILE| Not set, path to config file, True| No| Not set| Specifies the path to an S3 configuration file. If set, all commands will include --s3-config-file='path'. If 'True', the default configuration file at ./s3/tests/s3.conf will be used|
63+
| PGPROBACKUP_TMP_DIR| File path| No| tmp_dirs| The root of the temporary directory hierarchy where tests store data and logs. Relative paths start from the`tests` directory.|
5464
#Troubleshooting FAQ
5565

5666
##Python tests failure

‎tests/__init__.py

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

44
from .importinit_test,merge_test,option_test,show_test,compatibility_test, \
55
backup_test,delete_test,delta_test,restore_test,validate_test, \
6-
retention_test,pgpro560_test,pgpro589_test,pgpro2068_test,false_positive_test,replica_test, \
7-
compression_test,page_test,ptrack_test,archive_test,exclude_test,cfs_backup_test,cfs_restore_test,\
8-
cfs_validate_backup_test,auth_test,time_stamp_test,logging_test, \
6+
retention_test,pgpro560_test,pgpro589_test,false_positive_test,replica_test, \
7+
compression_test,page_test,ptrack_test,archive_test,exclude_test, \
8+
auth_test,time_stamp_test,logging_test, \
99
locking_test,remote_test,external_test,config_test,checkdb_test,set_backup_test,incr_restore_test, \
1010
catchup_test,CVE_2018_1058_test,time_consuming_test
1111

@@ -35,9 +35,6 @@ def load_tests(loader, tests, pattern):
3535
suite.addTests(loader.loadTestsFromModule(compatibility_test))
3636
suite.addTests(loader.loadTestsFromModule(checkdb_test))
3737
suite.addTests(loader.loadTestsFromModule(config_test))
38-
suite.addTests(loader.loadTestsFromModule(cfs_backup_test))
39-
suite.addTests(loader.loadTestsFromModule(cfs_restore_test))
40-
suite.addTests(loader.loadTestsFromModule(cfs_validate_backup_test))
4138
suite.addTests(loader.loadTestsFromModule(compression_test))
4239
suite.addTests(loader.loadTestsFromModule(delete_test))
4340
suite.addTests(loader.loadTestsFromModule(delta_test))
@@ -53,7 +50,6 @@ def load_tests(loader, tests, pattern):
5350
suite.addTests(loader.loadTestsFromModule(page_test))
5451
suite.addTests(loader.loadTestsFromModule(pgpro560_test))
5552
suite.addTests(loader.loadTestsFromModule(pgpro589_test))
56-
suite.addTests(loader.loadTestsFromModule(pgpro2068_test))
5753
suite.addTests(loader.loadTestsFromModule(remote_test))
5854
suite.addTests(loader.loadTestsFromModule(replica_test))
5955
suite.addTests(loader.loadTestsFromModule(restore_test))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp