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

Commit6114c47

Browse files
committed
Merge branch 'master' into remote_ssh
2 parentsfa146f5 +94d7c4b commit6114c47

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed

‎tests/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
ptrack_vacuum,ptrack_vacuum_bits_frozen,ptrack_vacuum_bits_visibility, \
88
ptrack_vacuum_full,ptrack_vacuum_truncate,pgpro560,pgpro589, \
99
false_positive,replica,compression,page,ptrack,archive, \
10-
exclude,cfs_backup,cfs_restore,cfs_validate_backup,auth_test
10+
exclude,cfs_backup,cfs_restore,cfs_validate_backup,auth_test, \
11+
time_stamp
1112

1213

1314
defload_tests(loader,tests,pattern):
@@ -48,6 +49,7 @@ def load_tests(loader, tests, pattern):
4849
suite.addTests(loader.loadTestsFromModule(validate_test))
4950
suite.addTests(loader.loadTestsFromModule(pgpro560))
5051
suite.addTests(loader.loadTestsFromModule(pgpro589))
52+
suite.addTests(loader.loadTestsFromModule(time_stamp))
5153

5254
returnsuite
5355

‎tests/helpers/ptrack_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,9 @@ def show_pb(
722722
ifbackup_id:
723723
cmd_list+= ['-i',backup_id]
724724

725+
# AHTUNG, WARNING will break json parsing
725726
ifas_json:
726-
cmd_list+= ['--format=json']
727+
cmd_list+= ['--format=json','--log-level-console=error']
727728

728729
ifas_text:
729730
# You should print it when calling as_text=true

‎tests/time_stamp.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
importos
2+
importunittest
3+
from .helpers.ptrack_helpersimportProbackupTest,ProbackupException
4+
5+
6+
module_name='time_stamp'
7+
8+
classCheckTimeStamp(ProbackupTest,unittest.TestCase):
9+
10+
deftest_start_time_format(self):
11+
"""Test backup ID changing after start-time editing in backup.control.
12+
We should convert local time in UTC format"""
13+
# Create simple node
14+
fname=self.id().split('.')[3]
15+
node=self.make_simple_node(base_dir="{0}/{1}/node".format(module_name,fname),
16+
initdb_params=['--data-checksums'],
17+
pg_options={'wal_level':'replica'}
18+
)
19+
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
20+
self.init_pb(backup_dir)
21+
self.add_instance(backup_dir,'node',node)
22+
self.set_archiving(backup_dir,'node',node)
23+
node.start()
24+
25+
backup_id=self.backup_node(backup_dir,'node',node,options=['--stream','-j 2'])
26+
show_backup=self.show_pb(backup_dir,'node')
27+
28+
i=0
29+
whilei<2:
30+
withopen(os.path.join(backup_dir,"backups","node",backup_id,"backup.control"),"r+")asf:
31+
output=""
32+
forlineinf:
33+
ifline.startswith('start-time')isTrue:
34+
ifi==0:
35+
output=output+str(line[:-5])+'+00\''+'\n'
36+
else:
37+
output=output+str(line[:-5])+'\''+'\n'
38+
else:
39+
output=output+str(line)
40+
f.close()
41+
42+
withopen(os.path.join(backup_dir,"backups","node",backup_id,"backup.control"),"w")asfw:
43+
fw.write(output)
44+
fw.flush()
45+
show_backup=show_backup+self.show_pb(backup_dir,'node')
46+
i+=1
47+
48+
self.assertTrue(show_backup[1]['id']==show_backup[2]['id'],"ERROR: Localtime format using instead of UTC")
49+
50+
node.stop()
51+
# Clean after yourself
52+
self.del_test_dir(module_name,fname)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp