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

Commit6de8b16

Browse files
author
Michael Paquier
committed
Incorporate new test facility in pg_arman
This new facility has the advantage on not relying on static data whengenerating the tests making the whole facility more robust. This isbasically taken from the upstream project pg_rman and adapted for thesake of this pet project, so most of the credit go to Kyotaro Horiguchiand Amit Langote regarding this facility. However I have adapted a bunchof things and fixed a lot of redundancy and code duplication.
1 parent8559733 commit6de8b16

Some content is hidden

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

42 files changed

+936
-466
lines changed

‎Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif # ASCIIDOC
3434
PG_CPPFLAGS = -I$(libpq_srcdir)
3535
PG_LIBS =$(libpq_pgport)
3636

37-
REGRESS = optioninit show_validate backup_restore
37+
REGRESS =initoptionshow delete backup restore
3838

3939
PG_CONFIG = pg_config
4040
PGXS :=$(shell$(PG_CONFIG) --pgxs)

‎README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ License
8383

8484
pg_arman can be distributed under the PostgreSQL license. See COPYRIGHT
8585
file for more information. pg_arman is a fork of the existing project
86-
pg_rman, initially created and maintained by NTT and Itagaki Takahiro.
86+
pg_arman, initially created and maintained by NTT and Itagaki Takahiro.

‎data/sample_backup/20090531/170553/backup.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎data/sample_backup/20090531/170553/database/PG_VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎data/sample_backup/20090531/170553/file_arclog.txt

Whitespace-only changes.

‎data/sample_backup/20090531/170553/file_database.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎data/sample_backup/20090601/170553/backup.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎data/sample_backup/20090601/170553/database/PG_VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎data/sample_backup/20090601/170553/file_arclog.txt

Whitespace-only changes.

‎data/sample_backup/20090601/170553/file_database.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎data/sample_backup/20090602/170553/backup.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎data/sample_backup/20090603/170553/backup.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎data/sample_backup/20090603/170553/file_arclog.txt

Whitespace-only changes.

‎data/sample_backup/20090603/170553/file_database.txt

Whitespace-only changes.

‎data/sample_backup/20090603/170553/file_srvlog.txt

Whitespace-only changes.

‎data/sample_backup/pg_arman.ini

Whitespace-only changes.

‎doc/pg_arman.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ pg_arman returns exit codes for each error status.
389389
26ERROR_PID_BROKENpostmaster.pid is broken
390390

391391
== AUTHOR ==
392-
pg_arman is a fork ofpg_rman that was originally written by NTT, now developed
392+
pg_arman is a fork ofpg_arman that was originally written by NTT, now developed
393393
and maintained by Michael Paquier.
394394

395395
Please report bug reports at <https://github.com/michaelpq/pg_arman>.

‎expected/backup.out

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
\! bash sql/backup.sh
2+
###### BACKUP COMMAND TEST-0001 ######
3+
###### full backup mode ######
4+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
5+
0
6+
1
7+
3
8+
###### BACKUP COMMAND TEST-0002 ######
9+
###### page-level backup mode ######
10+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
11+
0
12+
2
13+
6
14+
###### BACKUP COMMAND TEST-0003 ######
15+
###### full backup with compression ######
16+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
17+
0
18+
1
19+
0
20+
3
21+
###### BACKUP COMMAND TEST-0004 ######
22+
###### full backup with smooth checkpoint ######
23+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
24+
0
25+
1
26+
3
27+
###### BACKUP COMMAND TEST-0005 ######
28+
###### full backup with keep-data-generations and keep-data-days ######
29+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
30+
0
31+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
32+
0
33+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
34+
0
35+
The number of existing full backups validated is greater than 2.
36+
OK. Let's try to test --keep-data-generations=1.
37+
9
38+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
39+
0
40+
Number of remaining full backups validated: 2
41+
Number of deleted backups : 2
42+
6
43+
###### BACKUP COMMAND TEST-0006 ######
44+
###### switch backup mode from page to full ######
45+
page-level backup without validated full backup
46+
INFO: database backup start
47+
ERROR: Valid full backup not found for differential backup. Either create a full backup or validate existing one.
48+
10
49+
0
50+
0

‎expected/backup_restore.out

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎expected/delete.out

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
\! bash sql/delete.sh
2+
###### DELETE COMMAND TEST-0001 ######
3+
###### delete full backups ######
4+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
5+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
6+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
7+
try to delete the oldest backup
8+
2
9+
1
10+
Number of deleted backups should be 1, is it so?: 1
11+
###### DELETE COMMAND TEST-0002 ######
12+
###### keep backups which are necessary for recovery ######
13+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
14+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
15+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
16+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
17+
try to delete before third backup
18+
3
19+
1
20+
Number of deleted backups should be 1, is it so?: 1

‎expected/init.out

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1-
\! rm -rf results/init_test
2-
\! pg_arman init -B ${PWD}/results/init_test --quiet;echo $?
1+
\! bash sql/init.sh
2+
###### INIT COMMAND TEST-0001 ######
3+
###### success with archive_command ######
34
0
4-
\! find results/init_test | xargs ls -Fd | sort
5-
results/init_test/
6-
results/init_test/backup/
7-
results/init_test/backup/pg_xlog/
8-
results/init_test/pg_arman.ini
9-
\! pg_arman init -B ${PWD}/results/init_test --quiet;echo $?
5+
results/init/backup/
6+
results/init/backup/backup/
7+
results/init/backup/backup/pg_xlog/
8+
results/init/backup/pg_arman.ini
9+
###### INIT COMMAND TEST-0002 ######
10+
###### success with archive_command and log_directory ######
11+
0
12+
results/init/backup/
13+
results/init/backup/backup/
14+
results/init/backup/backup/pg_xlog/
15+
results/init/backup/pg_arman.ini
16+
###### INIT COMMAND TEST-0003 ######
17+
###### success without archive_command ######
18+
WARNING: ARCLOG_PATH is not set because archive_command is empty.Please set ARCLOG_PATH in pg_arman.ini or environmental variable
19+
0
20+
results/init/backup/
21+
results/init/backup/backup/
22+
results/init/backup/backup/pg_xlog/
23+
results/init/backup/pg_arman.ini
24+
###### INIT COMMAND TEST-0004 ######
25+
###### failure with backup catalog already existed ######
1026
ERROR: backup catalog already exist. and it's not empty.
1127
2
28+
29+
###### INIT COMMAND TEST-0005 ######
30+
###### failure with backup catalog should be given as absolute path ######
31+
ERROR: -B, --backup-path must be an absolute path
32+
12
33+

‎expected/option.out

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
\! sh sql/option.sh
1+
\! bash sql/option.sh
2+
###### COMMAND OPTION TEST-0001 ######
3+
###### help option ######
24
pg_arman manage backup/recovery of PostgreSQL database.
35

46
Usage:
@@ -49,22 +51,66 @@ Generic options:
4951

5052
Read the website for details. <https://github.com/michaelpq/pg_arman>
5153
Report bugs to <https://github.com/michaelpq/pg_arman/issues>.
54+
1
55+
56+
###### COMMAND OPTION TEST-0002 ######
57+
###### version option ######
5258
pg_arman 0.1
59+
1
60+
61+
###### COMMAND OPTION TEST-0003 ######
62+
###### backup command failure without backup path option ######
5363
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)
54-
ERROR: required parameter not specified: ARCLOG_PATH (-A, --arclog-path)
55-
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)
64+
12
65+
66+
###### COMMAND OPTION TEST-0004 ######
67+
###### backup command failure without backup mode option ######
5668
ERROR: Required parameter not specified: BACKUP_MODE (-b, --backup-mode)
69+
12
70+
71+
###### COMMAND OPTION TEST-0005 ######
72+
###### backup command failure with invalid backup mode option ######
5773
ERROR: invalid backup-mode "bad"
74+
12
75+
76+
###### COMMAND OPTION TEST-0006 ######
77+
###### delete failure without DATE ######
5878
ERROR: required delete range option not specified: delete DATE
59-
INFO: validate: 2009-05-31 17:05:53 backup and archive log files by CRC
60-
INFO: validate: 2009-06-01 17:05:53 backup and archive log files by CRC
61-
WARNING: CRC of backup file "PG_VERSION" must be 0 but FEF71BC1
62-
WARNING: backup 2009-06-01 17:05:53 is corrupted
79+
12
80+
81+
###### COMMAND OPTION TEST-0007 ######
82+
###### syntax error in pg_arman.ini ######
6383
WARNING: syntax error in " = INFINITE"
6484
ERROR: Required parameter not specified: BACKUP_MODE (-b, --backup-mode)
85+
12
86+
87+
###### COMMAND OPTION TEST-0008 ######
88+
###### invalid value in pg_arman.ini ######
6589
ERROR: invalid backup-mode ""
66-
ERROR: invalid backup-mode "B"
90+
12
91+
92+
###### COMMAND OPTION TEST-0009 ######
93+
###### invalid value in pg_arman.ini ######
6794
ERROR: option -Z, --compress-data should be a boolean: 'FOO'
95+
12
96+
97+
###### COMMAND OPTION TEST-0010 ######
98+
###### invalid value in pg_arman.ini ######
99+
ERROR: option --keep-data-generations should be a 32bit signed integer: 'TRUE'
100+
12
101+
102+
###### COMMAND OPTION TEST-0011 ######
103+
###### invalid value in pg_arman.ini ######
104+
ERROR: option -C, --smooth-checkpoint should be a boolean: 'FOO'
105+
12
106+
107+
###### COMMAND OPTION TEST-0012 ######
108+
###### invalid option in pg_arman.ini ######
68109
ERROR: invalid option "TIMELINEID"
69-
ERROR: invalid option "BACKUP_TARGETS"
110+
12
111+
112+
###### COMMAND OPTION TEST-0013 ######
113+
###### check priority of several pg_arman.ini files ######
70114
ERROR: invalid backup-mode "ENV_PATH"
115+
12
116+

‎expected/restore.out

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
\! bash sql/restore.sh
2+
###### RESTORE COMMAND TEST-0001 ######
3+
###### recovery to latest from full backup ######
4+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
5+
0
6+
0
7+
8+
###### RESTORE COMMAND TEST-0002 ######
9+
###### recovery to latest from full + page backups ######
10+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
11+
0
12+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
13+
0
14+
0
15+
16+
###### RESTORE COMMAND TEST-0003 ######
17+
###### recovery to latest from compressed full backup ######
18+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
19+
0
20+
0
21+
22+
###### RESTORE COMMAND TEST-0004 ######
23+
###### recovery to target timeline ######
24+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
25+
0
26+
0
27+
0
28+
checking recovery.conf...
29+
OK: recovery.conf has the given target timeline.
30+
31+
###### RESTORE COMMAND TEST-0005 ######
32+
###### recovery to target time ######
33+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
34+
0
35+
0
36+
37+
###### RESTORE COMMAND TEST-0006 ######
38+
###### recovery to target XID ######
39+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
40+
0
41+
0
42+
OK: recovery-target-xid options works well.
43+
44+
###### RESTORE COMMAND TEST-0007 ######
45+
###### recovery with target inclusive false ######
46+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
47+
0
48+
0
49+
OK: recovery-target-inclusive=false works well.
50+
51+
###### RESTORE COMMAND TEST-0008 ######
52+
###### recovery from page backup after database creation ######
53+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
54+
0
55+
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
56+
0
57+
0
58+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp