diff --git a/test/Vagrantfile b/test/Vagrantfile index 34856db91..e3884dc1b 100644 --- a/test/Vagrantfile +++ b/test/Vagrantfile @@ -85,10 +85,6 @@ Vagrant.configure(2) do |config| # apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended # apt-get install -y texlive-font-utils - #--------------------------------------------------------------------------------------------------------------------------- - echo 'Create Postgres Group & pgBackRest User' && date - adduser --uid=5001 --ingroup=vagrant --disabled-password --gecos "" pgbackrest - #--------------------------------------------------------------------------------------------------------------------------- echo 'Build VM Images' && date rm -rf /backrest/test/.vagrant/docker/* diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index fa7f733b5..e0fb6d57f 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -100,7 +100,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base [global] @@ -195,7 +195,7 @@ pg_data/special-!_.*'()&!@;:+,?={"master":true,"repo-size":[SIZE],"size":[SIZE], group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_hba.conf={"destination":"../pg_config/pg_hba.conf"} @@ -204,7 +204,7 @@ pg_data/postgresql.conf={"destination":"../pg_config/postgresql.conf"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -220,7 +220,7 @@ pg_data/pg_tblspc={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -291,7 +291,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base [global] @@ -393,7 +393,7 @@ pg_data/zero_from_start={"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_hba.conf={"destination":"../pg_config/pg_hba.conf"} @@ -402,7 +402,7 @@ pg_data/postgresql.conf={"destination":"../pg_config/postgresql.conf"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -418,7 +418,7 @@ pg_data/pg_tblspc={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -594,7 +594,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base [global] @@ -698,14 +698,14 @@ pg_tblspc/1/[TS_PATH-1]/16384/tablespace1.txt={"checksum":"14c44cef6287269b08d41 group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/1={"destination":"[TEST_PATH]/db-master/db/tablespace/ts1"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -725,7 +725,7 @@ pg_tblspc/1/[TS_PATH-1]/16384={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -800,7 +800,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base [global] @@ -907,7 +907,7 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2.txt={"checksum":"dc7f76e43c46101b47acc group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/1={"destination":"[TEST_PATH]/db-master/db/tablespace/ts1"} @@ -916,7 +916,7 @@ pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -941,7 +941,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -1016,7 +1016,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base [global] @@ -1122,7 +1122,7 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2.txt={"checksum":"dc7f76e43c46101b47acc group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/1={"destination":"[TEST_PATH]/db-master/db/tablespace/ts1"} @@ -1130,7 +1130,7 @@ pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -1153,7 +1153,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -1228,7 +1228,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base [global] @@ -1334,7 +1334,7 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2.txt={"checksum":"dc7f76e43c46101b47acc group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/1={"destination":"[TEST_PATH]/db-master/db/tablespace/ts1"} @@ -1342,7 +1342,7 @@ pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -1365,7 +1365,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -1464,7 +1464,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -1570,14 +1570,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2b.txt={"checksum":"e324463005236d83e6e5 group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -1597,7 +1597,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -1673,7 +1673,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -1779,14 +1779,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2b.txt={"checksum":"e324463005236d83e6e5 group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -1806,7 +1806,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -1886,7 +1886,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -1992,14 +1992,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2b.txt={"checksum":"e324463005236d83e6e5 group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -2019,7 +2019,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -2097,7 +2097,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -2203,14 +2203,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2b.txt={"checksum":"e324463005236d83e6e5 group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -2230,7 +2230,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -2312,7 +2312,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -2416,14 +2416,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt={"checksum":"dfcb8679956b734706cf group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -2443,7 +2443,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -2520,7 +2520,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -2624,14 +2624,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt={"checksum":"dfcb8679956b734706cf group="[GROUP-1]" master=true mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -2651,7 +2651,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -2733,7 +2733,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2 [global] @@ -2839,14 +2839,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt={"checksum":"dfcb8679956b734706cf group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"[TEST_PATH]/db-master/db/tablespace/ts2-2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -2866,7 +2866,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -2937,7 +2937,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf diff backup - config file not validated on remote (backup host) > [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --log-level-console=info --type=diff --stanza=db backup ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: backup command begin [BACKREST-VERSION]: --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff +P00 INFO: backup command begin [BACKREST-VERSION]: --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-3], version = [VERSION-1] @@ -2946,7 +2946,7 @@ P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-6] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff +P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: expire command end: completed successfully @@ -2985,7 +2985,7 @@ bogus=bogus pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2/base [global] @@ -3091,14 +3091,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt={"checksum":"dfcb8679956b734706cf group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"../../tablespace/ts2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -3118,7 +3118,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" @@ -3153,7 +3153,7 @@ backrest-checksum="[CHECKSUM]" diff backup - option backup-standby reset - backup performed from master (backup host) > [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --log-level-console=info --backup-standby --type=diff --stanza=db backup ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: backup command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff +P00 INFO: backup command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 WARN: option backup-standby is enabled but standby is not properly configured - backups will be performed from the master @@ -3163,7 +3163,7 @@ P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-7] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff +P00 INFO: expire command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: expire command end: completed successfully @@ -3201,7 +3201,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base-2/base [global] @@ -3307,14 +3307,14 @@ pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt={"checksum":"dfcb8679956b734706cf group="[GROUP-1]" master=false mode="0600" -user="[USER-2]" +user="[USER-1]" [target:link] pg_data/pg_tblspc/2={"destination":"../../tablespace/ts2"} [target:link:default] group="[GROUP-1]" -user="[USER-2]" +user="[USER-1]" [target:path] pg_data={} @@ -3334,7 +3334,7 @@ pg_tblspc/2/[TS_PATH-1]/32768={} [target:path:default] group="[GROUP-1]" mode="0700" -user="[USER-2]" +user="[USER-1]" [backrest] backrest-checksum="[CHECKSUM]" diff --git a/test/expect/mock-archive-002.log b/test/expect/mock-archive-002.log index 5de0e6f13..0f0c57a1c 100644 --- a/test/expect/mock-archive-002.log +++ b/test/expect/mock-archive-002.log @@ -28,7 +28,7 @@ P00 INFO: archive-get command end: aborted with exception [055] stanza-create db - stanza create (backup host) > [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stanza=db --no-online stanza-create ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: stanza-create command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db +P00 INFO: stanza-create command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db P00 DETAIL: tls statistics:[TLS-STATISTICS] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: stanza-create command end: completed successfully diff --git a/test/expect/mock-stanza-002.log b/test/expect/mock-stanza-002.log index 55d979319..68d5a7c7b 100644 --- a/test/expect/mock-stanza-002.log +++ b/test/expect/mock-stanza-002.log @@ -231,13 +231,13 @@ backrest-checksum="[CHECKSUM]" > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: archive-push command begin [BACKREST-VERSION]: [[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001] --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-2] --stanza=db +P00 INFO: archive-push command begin [BACKREST-VERSION]: [[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001] --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-1] --stanza=db P00 INFO: pushed WAL file '000000010000000100000001' to the archive P00 INFO: archive-push command end: completed successfully > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: archive-push command begin [BACKREST-VERSION]: [[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002] --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-2] --stanza=db +P00 INFO: archive-push command begin [BACKREST-VERSION]: [[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002] --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-1] --stanza=db P00 INFO: pushed WAL file '000000010000000100000002' to the archive P00 INFO: archive-push command end: completed successfully @@ -300,7 +300,7 @@ backrest-checksum="[CHECKSUM]" > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get 000000010000000100000002 [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: archive-get command begin [BACKREST-VERSION]: [000000010000000100000002, [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG] --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-2] --stanza=db +P00 INFO: archive-get command begin [BACKREST-VERSION]: [000000010000000100000002, [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG] --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-1] --stanza=db P00 INFO: found 000000010000000100000002 in the archive P00 INFO: archive-get command end: completed successfully @@ -349,7 +349,7 @@ protocol-timeout=60 repo1-host=backup repo1-host-cmd=[BACKREST-BIN] repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf -repo1-host-user=[USER-2] +repo1-host-user=[USER-1] spool-path=[TEST_PATH]/db-master/spool + supplemental file: [TEST_PATH]/backup/pgbackrest.conf @@ -548,7 +548,7 @@ protocol-timeout=60 repo1-host=backup repo1-host-cmd=[BACKREST-BIN] repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf -repo1-host-user=[USER-2] +repo1-host-user=[USER-1] spool-path=[TEST_PATH]/db-master/spool + supplemental file: [TEST_PATH]/backup/pgbackrest.conf diff --git a/test/expect/real-all-004.log b/test/expect/real-all-004.log index e83a497b8..204d04bd2 100644 --- a/test/expect/real-all-004.log +++ b/test/expect/real-all-004.log @@ -128,7 +128,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 @@ -199,7 +199,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 @@ -287,7 +287,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 diff --git a/test/expect/real-all-005.log b/test/expect/real-all-005.log index 027d66e0d..62e6fa986 100644 --- a/test/expect/real-all-005.log +++ b/test/expect/real-all-005.log @@ -67,18 +67,18 @@ spool-path=[TEST_PATH]/db-standby/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 pg2-host=bogus pg2-host-cmd=[BACKREST-BIN] pg2-host-config=[TEST_PATH]/db-standby/pgbackrest.conf -pg2-host-user=[USER-2] +pg2-host-user=[USER-1] pg2-path=[TEST_PATH]/db-standby/db/base pg8-host=db-standby pg8-host-cmd=[BACKREST-BIN] pg8-host-config=[TEST_PATH]/db-standby/pgbackrest.conf -pg8-host-user=[USER-2] +pg8-host-user=[USER-1] pg8-path=[TEST_PATH]/db-standby/db/base pg8-port=6544 @@ -180,18 +180,18 @@ spool-path=[TEST_PATH]/db-standby/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 pg2-host=bogus pg2-host-cmd=[BACKREST-BIN] pg2-host-config=[TEST_PATH]/db-standby/pgbackrest.conf -pg2-host-user=[USER-2] +pg2-host-user=[USER-1] pg2-path=[TEST_PATH]/db-standby/db/base pg8-host=db-standby pg8-host-cmd=[BACKREST-BIN] pg8-host-config=[TEST_PATH]/db-standby/pgbackrest.conf -pg8-host-user=[USER-2] +pg8-host-user=[USER-1] pg8-path=[TEST_PATH]/db-standby/db/base pg8-port=6544 @@ -283,18 +283,18 @@ spool-path=[TEST_PATH]/db-standby/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 pg2-host=bogus pg2-host-cmd=[BACKREST-BIN] pg2-host-config=[TEST_PATH]/db-standby/pgbackrest.conf -pg2-host-user=[USER-2] +pg2-host-user=[USER-1] pg2-path=[TEST_PATH]/db-standby/db/base pg8-host=db-standby pg8-host-cmd=[BACKREST-BIN] pg8-host-config=[TEST_PATH]/db-standby/pgbackrest.conf -pg8-host-user=[USER-2] +pg8-host-user=[USER-1] pg8-path=[TEST_PATH]/db-standby/db/base pg8-port=6544 diff --git a/test/expect/real-all-006.log b/test/expect/real-all-006.log index 0db3a8ad6..d7f711183 100644 --- a/test/expect/real-all-006.log +++ b/test/expect/real-all-006.log @@ -129,7 +129,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 @@ -195,7 +195,7 @@ spool-path=[TEST_PATH]/db-master/spool pg1-host=db-master pg1-host-cmd=[BACKREST-BIN] pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf -pg1-host-user=[USER-2] +pg1-host-user=[USER-1] pg1-path=[TEST_PATH]/db-master/db/base pg1-port=6543 diff --git a/test/lib/pgBackRestTest/Common/BuildTest.pm b/test/lib/pgBackRestTest/Common/BuildTest.pm index 217a43691..20bef5e3f 100644 --- a/test/lib/pgBackRestTest/Common/BuildTest.pm +++ b/test/lib/pgBackRestTest/Common/BuildTest.pm @@ -273,7 +273,6 @@ sub buildMakefile ('#' x 132) . "\n" . buildMakefileObjectCompile($oStorage, {rhOption => $rhOption}); - # Return from function and log return values if any return logDebugReturn ( diff --git a/test/lib/pgBackRestTest/Common/ContainerTest.pm b/test/lib/pgBackRestTest/Common/ContainerTest.pm index 497075022..c95266fdc 100755 --- a/test/lib/pgBackRestTest/Common/ContainerTest.pm +++ b/test/lib/pgBackRestTest/Common/ContainerTest.pm @@ -28,12 +28,6 @@ use pgBackRestTest::Common::VmTest; #################################################################################################################################### # User/group definitions #################################################################################################################################### -use constant POSTGRES_GROUP => 'postgres'; - push @EXPORT, qw(POSTGRES_GROUP); -use constant POSTGRES_GROUP_ID => 5000; -use constant POSTGRES_USER => POSTGRES_GROUP; -use constant POSTGRES_USER_ID => 5000; - use constant TEST_USER => getpwuid($UID) . ''; push @EXPORT, qw(TEST_USER); use constant TEST_USER_ID => $UID; @@ -41,18 +35,6 @@ use constant TEST_GROUP => getgrgid( push @EXPORT, qw(TEST_GROUP); use constant TEST_GROUP_ID => getgrnam(TEST_GROUP) . ''; -use constant BACKREST_USER => 'pgbackrest'; - push @EXPORT, qw(BACKREST_USER); -use constant BACKREST_USER_ID => getpwnam(BACKREST_USER) ? getpwnam(BACKREST_USER) . '' : undef; - -#################################################################################################################################### -# Package constants -#################################################################################################################################### -use constant LIB_COVER_VERSION => '1.29-2'; - push @EXPORT, qw(LIB_COVER_VERSION); -use constant LIB_COVER_EXE => '/usr/bin/cover'; - push @EXPORT, qw(LIB_COVER_EXE); - #################################################################################################################################### # Cert file constants #################################################################################################################################### @@ -74,18 +56,6 @@ use constant CONTAINER_DEBUG => false; #################################################################################################################################### my $hContainerCache; -#################################################################################################################################### -# Generate Devel::Cover package name -#################################################################################################################################### -sub packageDevelCover -{ - my $strArch = shift; - - return 'libdevel-cover-perl_' . LIB_COVER_VERSION . "_${strArch}.deb"; -} - -push @EXPORT, qw(packageDevelCover); - #################################################################################################################################### # Container repo - defines the Docker repository where the containers will be located #################################################################################################################################### @@ -463,11 +433,6 @@ sub containerBuild #--------------------------------------------------------------------------------------------------------------------------- if (!$bDeprecated) { - $strScript .= sectionHeader() . - "# Create PostgreSQL user/group with known ids for testing\n" . - ' ' . groupCreate($strOS, POSTGRES_GROUP, POSTGRES_GROUP_ID) . " && \\\n" . - ' ' . userCreate($strOS, POSTGRES_USER, POSTGRES_USER_ID, POSTGRES_GROUP); - $strScript .= sectionHeader() . "# Install PostgreSQL packages\n"; @@ -567,8 +532,6 @@ sub containerBuild $strImage = "${strOS}-build"; $strCopy = undef; - my $strPkgDevelCover = packageDevelCover($oVm->{$strOS}{&VM_ARCH}); - $strScript = sectionHeader() . "# Create test user\n" . ' ' . groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . " && \\\n" . @@ -643,13 +606,6 @@ sub containerBuild $strScript .= sshSetup($strOS, TEST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER}); - $strScript .= sectionHeader() . - "# Create pgbackrest user\n" . - ' ' . userCreate($strOS, BACKREST_USER, BACKREST_USER_ID, TEST_GROUP); - - $strScript .= - sshSetup($strOS, BACKREST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER}); - $strScript .= sectionHeader() . "# Make " . TEST_USER . " home dir readable\n" . ' chmod g+r,g+x /home/' . TEST_USER; diff --git a/test/lib/pgBackRestTest/Common/FileTest.pm b/test/lib/pgBackRestTest/Common/FileTest.pm index e446a3275..773f84b75 100644 --- a/test/lib/pgBackRestTest/Common/FileTest.pm +++ b/test/lib/pgBackRestTest/Common/FileTest.pm @@ -84,7 +84,7 @@ sub testPathRemove my $strPath = shift; my $bSuppressError = shift; - executeTest('sudo rm -rf ' . $strPath, {bSuppressError => $bSuppressError}); + executeTest('rm -rf ' . $strPath, {bSuppressError => $bSuppressError}); } push(@EXPORT, qw(testPathRemove)); @@ -170,7 +170,7 @@ sub forceStorageMode # Mode commands are ignored on S3 if ($oStorage->type() ne STORAGE_S3) { - executeTest('sudo chmod ' . ($bRecurse ? '-R ' : '') . "${strMode} " . $oStorage->pathGet($strPathExp)); + executeTest('chmod ' . ($bRecurse ? '-R ' : '') . "${strMode} " . $oStorage->pathGet($strPathExp)); } # Return from function and log return values if any @@ -237,7 +237,7 @@ sub forceStorageMove # Else remove using filesystem commands else { - executeTest('sudo mv ' . $oStorage->pathGet($strSourcePathExp) . ' ' . $oStorage->pathGet($strDestinationPathExp)); + executeTest('mv ' . $oStorage->pathGet($strSourcePathExp) . ' ' . $oStorage->pathGet($strDestinationPathExp)); } # Return from function and log return values if any @@ -272,7 +272,7 @@ sub forceStorageOwner # Owner commands are ignored on S3 if ($oStorage->type() ne STORAGE_S3) { - executeTest('sudo chown ' . ($bRecurse ? '-R ' : '') . "${strOwner} " . $oStorage->pathGet($strPathExp)); + executeTest('chown ' . ($bRecurse ? '-R ' : '') . "${strOwner} " . $oStorage->pathGet($strPathExp)); } # Return from function and log return values if any @@ -318,7 +318,7 @@ sub forceStorageRemove } else { - executeTest('sudo rm -f' . ($bRecurse ? 'r ' : ' ') . $oStorage->pathGet($strPathExp)); + executeTest('rm -f' . ($bRecurse ? 'r ' : ' ') . $oStorage->pathGet($strPathExp)); } # Return from function and log return values if any diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 46f453366..db2c77e88 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -57,6 +57,7 @@ sub new $self->{strTestPath}, $self->{oTest}, $self->{bDryRun}, + $self->{strVmHost}, $self->{bVmOut}, $self->{iVmIdx}, $self->{iVmMax}, @@ -87,6 +88,7 @@ sub new {name => 'strTestPath'}, {name => 'oTest'}, {name => 'bDryRun'}, + {name => 'strVmHost'}, {name => 'bVmOut'}, {name => 'iVmIdx'}, {name => 'iVmMax'}, @@ -232,9 +234,7 @@ sub run # If testing Perl code (or C code that calls Perl code) install bin and Perl C Library if ($self->{oTest}->{&TEST_VM} ne VM_NONE && (!$self->{oTest}->{&TEST_C} || $self->{oTest}->{&TEST_PERL_REQ})) { - jobInstallC( - $self->{strBackRestBase}, $self->{oTest}->{&TEST_VM}, $strImage, - !$self->{oTest}->{&TEST_C} && !$self->{oTest}->{&TEST_INTEGRATION}); + jobInstallC($self->{strBackRestBase}, $self->{oTest}->{&TEST_VM}, $strImage); } } } @@ -269,6 +269,7 @@ sub run ($self->{oTest}->{&TEST_CONTAINER} ? 'docker exec -i -u ' . TEST_USER . " ${strImage} " : '') . abs_path($0) . " --test-path=${strVmTestPath}" . + " --vm-host=$self->{strVmHost}" . " --vm=$self->{oTest}->{&TEST_VM}" . " --vm-id=$self->{iVmIdx}" . " --module=" . $self->{oTest}->{&TEST_MODULE} . @@ -753,7 +754,7 @@ sub end containerRemove("test-$self->{iVmIdx}"); } - executeTest(($self->{oTest}->{&TEST_VM} ne VM_NONE ? "sudo " : '') . "rm -rf ${strHostTestPath}"); + executeTest("rm -rf ${strHostTestPath}"); } $bDone = true; @@ -776,20 +777,15 @@ sub jobInstallC my $strBasePath = shift; my $strVm = shift; my $strImage = shift; - my $bCopyLibC = shift; # Install Perl C Library my $oVm = vmGet(); my $strBuildPath = "${strBasePath}/test/.vagrant/bin/${strVm}"; my $strBuildLibCPath = "${strBuildPath}/libc"; my $strBuildBinPath = "${strBuildPath}/src"; - my $strPerlAutoPath = $oVm->{$strVm}{&VMDEF_PERL_ARCH_PATH} . '/auto/pgBackRest/LibC'; executeTest( "docker exec -i -u root ${strImage} bash -c '" . - (defined($bCopyLibC) && $bCopyLibC ? - "mkdir -p -m 755 ${strPerlAutoPath} && " . - "cp ${strBuildLibCPath}/blib/arch/auto/pgBackRest/LibC/LibC.so ${strPerlAutoPath} && " : '') . "cp ${strBuildBinPath}/" . PROJECT_EXE . ' /usr/bin/' . PROJECT_EXE . ' && ' . 'chmod 755 /usr/bin/' . PROJECT_EXE . "'"); } diff --git a/test/lib/pgBackRestTest/Common/ListTest.pm b/test/lib/pgBackRestTest/Common/ListTest.pm index 0f9941115..0b5a84c03 100644 --- a/test/lib/pgBackRestTest/Common/ListTest.pm +++ b/test/lib/pgBackRestTest/Common/ListTest.pm @@ -38,8 +38,6 @@ use constant TEST_MODULE => 'module'; push @EXPORT, qw(TEST_MODULE); use constant TEST_NAME => 'test'; push @EXPORT, qw(TEST_NAME); -use constant TEST_PERL_ARCH_PATH => VMDEF_PERL_ARCH_PATH; - push @EXPORT, qw(TEST_PERL_ARCH_PATH); use constant TEST_PERL_REQ => 'perl-req'; push @EXPORT, qw(TEST_PERL_REQ); use constant TEST_PGSQL_BIN => 'pgsql-bin'; @@ -174,7 +172,6 @@ sub testListGet &TEST_CONTAINER => defined($hTest->{&TESTDEF_CONTAINER}) ? $hTest->{&TESTDEF_CONTAINER} : $hModule->{&TESTDEF_CONTAINER}, &TEST_PGSQL_BIN => $strPgSqlBin, - &TEST_PERL_ARCH_PATH => $$oyVm{$strTestOS}{&VMDEF_PERL_ARCH_PATH}, &TEST_PERL_REQ => $hTest->{&TESTDEF_PERL_REQ}, &TEST_INTEGRATION => $hTest->{&TESTDEF_INTEGRATION}, &TEST_MODULE => $strModule, diff --git a/test/lib/pgBackRestTest/Common/RunTest.pm b/test/lib/pgBackRestTest/Common/RunTest.pm index 916e9ff53..dcf637a1a 100644 --- a/test/lib/pgBackRestTest/Common/RunTest.pm +++ b/test/lib/pgBackRestTest/Common/RunTest.pm @@ -90,7 +90,7 @@ sub cleanTest { my $self = shift; - executeTest('sudo rm -rf ' . $self->testPath() . '/*'); + executeTest('rm -rf ' . $self->testPath() . '/*'); } #################################################################################################################################### @@ -126,7 +126,6 @@ sub process $self->{bCleanup}, $self->{bLogForce}, $self->{strPgUser}, - $self->{strBackRestUser}, $self->{strGroup}, ) = logDebugParam @@ -148,7 +147,6 @@ sub process {name => 'bCleanup'}, {name => 'bLogForce'}, {name => 'strPgUser'}, - {name => 'strBackRestUser'}, {name => 'strGroup'}, ); @@ -544,7 +542,6 @@ push(@EXPORT, qw(storageTest)); #################################################################################################################################### sub archBits {return vmArchBits(shift->{strVm})} sub backrestExe {return shift->{strBackRestExe}} -sub backrestUser {return shift->{strBackRestUser}} sub basePath {return shift->{strBasePath}} sub dataPath {return shift->basePath() . '/test/data'} sub doCleanup {return shift->{bCleanup}} diff --git a/test/lib/pgBackRestTest/Common/VmTest.pm b/test/lib/pgBackRestTest/Common/VmTest.pm index 2cf957e60..f7073ce09 100644 --- a/test/lib/pgBackRestTest/Common/VmTest.pm +++ b/test/lib/pgBackRestTest/Common/VmTest.pm @@ -43,8 +43,6 @@ use constant VM_OS_REPO => 'os-repo' push @EXPORT, qw(VM_OS_REPO); use constant VMDEF_PGSQL_BIN => 'pgsql-bin'; push @EXPORT, qw(VMDEF_PGSQL_BIN); -use constant VMDEF_PERL_ARCH_PATH => 'perl-arch-path'; - push @EXPORT, qw(VMDEF_PERL_ARCH_PATH); use constant VMDEF_WITH_BACKTRACE => 'with-backtrace'; push @EXPORT, qw(VMDEF_WITH_BACKTRACE); @@ -129,12 +127,11 @@ my $oyVm = # None &VM_NONE => { - &VM_OS_BASE => VM_OS_BASE_RHEL, - &VM_OS => VM_OS_CENTOS, + &VM_OS_BASE => VM_OS_BASE_DEBIAN, + &VM_OS => VM_OS_UBUNTU, &VM_ARCH => VM_ARCH_AMD64, &VMDEF_COVERAGE_C => true, - &VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5', + &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', &VM_DB => [ @@ -155,7 +152,6 @@ my $oyVm = &VM_IMAGE => 'centos:6', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5', &VM_DB => [ @@ -185,7 +181,6 @@ my $oyVm = &VM_IMAGE => 'centos:7', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5', &VMDEF_DEBUG_INTEGRATION => false, @@ -212,7 +207,6 @@ my $oyVm = &VM_IMAGE => 'fedora:30', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5', &VMDEF_DEBUG_INTEGRATION => false, @@ -241,7 +235,6 @@ my $oyVm = &VM_IMAGE => 'debian:8', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.20.2', &VM_DB => [ @@ -272,7 +265,6 @@ my $oyVm = &VM_IMAGE => 'debian:9', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib/i386-linux-gnu/perl/5.24.1', &VM_DB_TEST => [ @@ -300,7 +292,6 @@ my $oyVm = &VM_IMAGE => 'i386/ubuntu:12.04', &VM_ARCH => VM_ARCH_I386, &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib/perl/5.14.2', &VM_DB => [ @@ -330,7 +321,6 @@ my $oyVm = &VM_IMAGE => 'ubuntu:14.04', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib/perl/5.18.2', &VM_DB => [ @@ -361,7 +351,6 @@ my $oyVm = &VM_IMAGE => 'ubuntu:16.04', &VM_ARCH => VM_ARCH_AMD64, &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.22.1', &VMDEF_WITH_BACKTRACE => true, @@ -394,7 +383,6 @@ my $oyVm = &VM_ARCH => VM_ARCH_AMD64, &VMDEF_COVERAGE_C => true, &VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin', - &VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.26.1', &VMDEF_WITH_BACKTRACE => true, diff --git a/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm b/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm index 9f3034955..ce7399dcc 100644 --- a/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm +++ b/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm @@ -190,7 +190,7 @@ sub stanzaCreate # Generate pg_control for stanza-create $self->controlGenerate($strDbPath, $strDbVersion); - executeTest('sudo chmod 600 ' . $strDbPath . '/' . DB_FILE_PGCONTROL); + executeTest('chmod 600 ' . $strDbPath . '/' . DB_FILE_PGCONTROL); # Create the stanza repo paths if they don't exist if (!cfgOptionTest(CFGOPT_REPO_TYPE, CFGOPTVAL_REPO_TYPE_S3)) @@ -237,7 +237,7 @@ sub stanzaUpgrade # Copy pg_control for stanza-upgrade $self->controlGenerate(cfgOption(CFGOPT_PG_PATH), $strDbVersion); - executeTest('sudo chmod 600 ' . cfgOption(CFGOPT_PG_PATH) . '/' . DB_FILE_PGCONTROL); + executeTest('chmod 600 ' . cfgOption(CFGOPT_PG_PATH) . '/' . DB_FILE_PGCONTROL); $self->stanzaSet($strStanza, $strDbVersion, true); diff --git a/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm b/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm index 50904e945..fe0042dca 100644 --- a/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm +++ b/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm @@ -78,15 +78,15 @@ sub new { $strName = HOST_BACKUP; $strImage = containerRepo() . ':' . testRunGet()->vm() . '-test'; - $strUser = testRunGet()->backrestUser(); } else { $strName = $$oParam{strName}; $strImage = $$oParam{strImage}; - $strUser = testRunGet()->pgUser(); } + $strUser = testRunGet()->pgUser(); + # Create the host my $self = $class->SUPER::new($strName, {strImage => $strImage, strUser => $strUser}); bless $self, $class; @@ -1181,9 +1181,6 @@ sub configCreate # Write out the configuration file storageTest()->put($self->backrestConfig(), iniRender(\%oParamHash, true)); - - # Modify the file permissions so it can be read/saved by all test users - executeTest('sudo chmod 660 ' . $self->backrestConfig()); } #################################################################################################################################### @@ -1217,17 +1214,8 @@ sub configUpdate } } - # Modify the file permissions so it can be saved by all test users - executeTest( - 'sudo chmod 660 ' . $self->backrestConfig() . ' && sudo chmod 770 ' . dirname($self->backrestConfig())); - storageTest()->put($self->backrestConfig(), iniRender($oConfig, true)); - # Fix permissions back to original - executeTest( - 'sudo chmod 660 ' . $self->backrestConfig() . ' && sudo chmod 770 ' . dirname($self->backrestConfig()) . - ' && sudo chown ' . $self->userGet() . ' ' . $self->backrestConfig()); - # Return from function and log return values if any return logDebugReturn($strOperation); } @@ -1368,23 +1356,9 @@ sub infoMunge } } - # Modify the file/directory permissions so it can be saved - if ($self->isFS()) - { - executeTest("sudo rm -f ${strFileName}* && sudo chmod 770 " . dirname($strFileName)); - } - # Save the munged data to the file $oMungeIni->save(); - # Fix permissions - if ($self->isFS()) - { - executeTest( - "sudo chmod 640 ${strFileName}* && sudo chmod 750 " . dirname($strFileName) . - ' && sudo chown ' . $self->userGet() . " ${strFileName}*"); - } - # Clear the cache is requested if (!$bCache) { @@ -1424,23 +1398,9 @@ sub infoRestore { if ($bSave) { - # Modify the file/directory permissions so it can be saved - if ($self->isFS()) - { - executeTest("sudo rm -f ${strFileName}* && sudo chmod 770 " . dirname($strFileName)); - } - # Save the munged data to the file $self->{hInfoFile}{$strFileName}->{bModified} = true; $self->{hInfoFile}{$strFileName}->save(); - - # Fix permissions - if ($self->isFS()) - { - executeTest( - "sudo chmod 640 ${strFileName} && sudo chmod 750 " . dirname($strFileName) . - ' && sudo chown ' . $self->userGet() . " ${strFileName}*"); - } } } else @@ -1553,16 +1513,7 @@ sub configRemap # Save backup config file (but not if this is the standby which is not the source of backups) if (defined($oHostBackup)) { - # Modify the file permissions so it can be read/saved by all test users - executeTest( - 'sudo chmod 660 ' . $oHostBackup->backrestConfig() . ' && sudo chmod 770 ' . dirname($oHostBackup->backrestConfig())); - storageTest()->put($oHostBackup->backrestConfig(), iniRender($oRemoteConfig, true)); - - # Fix permissions - executeTest( - 'sudo chmod 660 ' . $oHostBackup->backrestConfig() . ' && sudo chmod 770 ' . dirname($oHostBackup->backrestConfig()) . - ' && sudo chown ' . $oHostBackup->userGet() . ' ' . $oHostBackup->backrestConfig()); } } diff --git a/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm b/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm index 1305a1997..1a2daefec 100644 --- a/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm @@ -112,7 +112,7 @@ sub run "encryption incompatible for '$strArchiveFile'" . "\nHINT: is or was the repo encrypted?"); - executeTest('sudo rm ' . $strArchiveFile); + executeTest('rm ' . $strArchiveFile); # Attempt to reconstruct from an encypted archived WAL with an encrypted repo #--------------------------------------------------------------------------------------------------------------------------- @@ -209,7 +209,7 @@ sub run "\nHINT: is or was the repo encrypted?"); # Remove the archive info files - executeTest('sudo rm ' . $oArchiveInfo->{strFileName} . '*'); + executeTest('rm ' . $oArchiveInfo->{strFileName} . '*'); # Create an encrypted storage and archive.info file #--------------------------------------------------------------------------------------------------------------------------- diff --git a/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm b/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm index d027b5c59..f7da5ec61 100644 --- a/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm @@ -220,7 +220,7 @@ sub run # Create encrypted files, change the passphrase and attempt to load - ensure flush error returned as parse error #--------------------------------------------------------------------------------------------------------------------------- # Remove the backup info files - executeTest('sudo rm ' . $oBackupInfo->{strFileName} . '*'); + executeTest('rm ' . $oBackupInfo->{strFileName} . '*'); # Clear the storage repo settings and change the passphrase storageRepoCacheClear(); diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index 4daeb588e..ac5acb484 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -539,8 +539,7 @@ sub run } else { - executeTest("sudo touch ${strTempFile}", {bRemote => $bRemote}); - executeTest("sudo chown " . BACKREST_USER . " ${strResumePath}/file.tmp"); + executeTest("touch ${strTempFile}", {bRemote => $bRemote}); } # Add zero-sized file diff --git a/test/lib/pgBackRestTest/Module/Mock/MockArchiveTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockArchiveTest.pm index fe9a03ecd..f701128b3 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockArchiveTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockArchiveTest.pm @@ -214,13 +214,7 @@ sub run substr($strSourceFile, 0, 16) . "/${strSourceFile}-${strArchiveChecksum}." . COMPRESS_EXT . qw{.} . STORAGE_TEMP_EXT; - executeTest('sudo chmod 770 ' . dirname($strArchiveTmp)); storageTest()->put($strArchiveTmp, 'JUNK'); - - if ($bRemote) - { - executeTest('sudo chown ' . $oHostBackup->userGet() . " ${strArchiveTmp}"); - } } # Push the WAL diff --git a/test/src/common/harnessTest.c b/test/src/common/harnessTest.c index 5b8c078f4..24f9d3b59 100644 --- a/test/src/common/harnessTest.c +++ b/test/src/common/harnessTest.c @@ -298,6 +298,41 @@ testAdd(int run, bool selected) FUNCTION_HARNESS_RESULT_VOID(); } +/*********************************************************************************************************************************** +Initialize harness +***********************************************************************************************************************************/ +void +testInit(void) +{ + FUNCTION_HARNESS_VOID(); + + // Set test user + const char *testUserTemp = getpwuid(getuid())->pw_name; + + if (strlen(testUserTemp) > sizeof(testUserData) - 1) + { + fprintf(stderr, "ERROR: test user name must be less than %zu characters", sizeof(testUserData) - 1); + fflush(stderr); + exit(255); + } + + strcpy(testUserData, testUserTemp); + + // Set test group + const char *testGroupTemp = getgrgid(getgid())->gr_name; + + if (strlen(testGroupTemp) > sizeof(testGroupData) - 1) + { + fprintf(stderr, "ERROR: test group name must be less than %zu characters", sizeof(testGroupData) - 1); + fflush(stderr); + exit(255); + } + + strcpy(testGroupData, testGroupTemp); + + FUNCTION_HARNESS_RESULT_VOID(); +} + /*********************************************************************************************************************************** testBegin - should this test run? ***********************************************************************************************************************************/ @@ -315,25 +350,6 @@ testBegin(const char *name) if (testList[testRun - 1].selected) { - if (testFirst) - { - // Set test user - const char *testUserTemp = getpwuid(getuid())->pw_name; - - if (strlen(testUserTemp) > sizeof(testUserData) - 1) - THROW_FMT(AssertError, "test user name must be less than %zu characters", sizeof(testUserData) - 1); - - strcpy(testUserData, testUserTemp); - - // Set test group - const char *testGroupTemp = getgrgid(getgid())->gr_name; - - if (strlen(testGroupTemp) > sizeof(testGroupData) - 1) - THROW_FMT(AssertError, "test group name must be less than %zu characters", sizeof(testGroupData) - 1); - - strcpy(testGroupData, testGroupTemp); - } - #ifndef NO_LOG if (!testFirst) { diff --git a/test/src/module/protocol/protocolTest.c b/test/src/module/protocol/protocolTest.c index 5f0250ff9..6f7dcc6ea 100644 --- a/test/src/module/protocol/protocolTest.c +++ b/test/src/module/protocol/protocolTest.c @@ -793,6 +793,7 @@ testRun(void) strLstAddZ(argList, "--stanza=db"); strLstAddZ(argList, "--protocol-timeout=10"); strLstAddZ(argList, "--repo1-host=localhost"); + strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser())); strLstAdd(argList, strNewFmt("--repo1-path=%s", testPath())); harnessCfgLoad(cfgCmdInfo, argList); @@ -821,6 +822,7 @@ testRun(void) strLstAddZ(argList, "--protocol-timeout=10"); strLstAdd(argList, strNewFmt("--config=%s/pgbackrest.conf", testPath())); strLstAddZ(argList, "--repo1-host=localhost"); + strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser())); strLstAdd(argList, strNewFmt("--repo1-path=%s", testPath())); strLstAddZ(argList, "--process=999"); strLstAddZ(argList, "--command=archive-get"); @@ -849,6 +851,7 @@ testRun(void) strLstAddZ(argList, "--protocol-timeout=10"); strLstAdd(argList, strNewFmt("--repo1-host-config=%s/pgbackrest.conf", testPath())); strLstAddZ(argList, "--repo1-host=localhost"); + strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser())); strLstAdd(argList, strNewFmt("--repo1-path=%s", testPath())); harnessCfgLoad(cfgCmdInfo, argList); diff --git a/test/src/module/storage/remoteTest.c b/test/src/module/storage/remoteTest.c index d62f3ff0a..ecdc9d9f7 100644 --- a/test/src/module/storage/remoteTest.c +++ b/test/src/module/storage/remoteTest.c @@ -8,6 +8,7 @@ Test Remote Storage #include "postgres/interface.h" #include "common/harnessConfig.h" +#include "common/harnessTest.h" /*********************************************************************************************************************************** Test Run @@ -27,6 +28,7 @@ testRun(void) strLstAddZ(argList, "--protocol-timeout=10"); strLstAddZ(argList, "--buffer-size=16384"); strLstAddZ(argList, "--repo1-host=localhost"); + strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser())); strLstAdd(argList, strNewFmt("--repo1-path=%s/repo", testPath())); harnessCfgLoad(cfgCmdInfo, argList); @@ -281,7 +283,6 @@ testRun(void) if (testBegin("storageNewWrite()")) { storagePathCreateNP(storageTest, strNew("repo")); - TEST_RESULT_INT(system(strPtr(strNewFmt("sudo chown pgbackrest %s/repo", testPath()))), 0, "update repo owner"); Storage *storageRemote = NULL; TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); @@ -445,7 +446,6 @@ testRun(void) { String *path = strNew("testpath"); storagePathCreateNP(storageTest, strNew("repo")); - TEST_RESULT_INT(system(strPtr(strNewFmt("sudo chown pgbackrest %s/repo", testPath()))), 0, "update repo owner"); Storage *storageRemote = NULL; TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); @@ -504,7 +504,6 @@ testRun(void) { String *path = strNew("testpath"); storagePathCreateNP(storageTest, strNew("repo")); - TEST_RESULT_INT(system(strPtr(strNewFmt("sudo chown pgbackrest %s/repo", testPath()))), 0, "update repo owner"); Storage *storageRemote = NULL; TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); @@ -545,7 +544,6 @@ testRun(void) if (testBegin("storageRemove()")) { storagePathCreateNP(storageTest, strNew("repo")); - TEST_RESULT_INT(system(strPtr(strNewFmt("sudo chown pgbackrest %s/repo", testPath()))), 0, "update repo owner"); Storage *storageRemote = NULL; TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); @@ -594,7 +592,6 @@ testRun(void) if (testBegin("storagePathSync()")) { storagePathCreateNP(storageTest, strNew("repo")); - TEST_RESULT_INT(system(strPtr(strNewFmt("sudo chown pgbackrest %s/repo", testPath()))), 0, "update repo owner"); Storage *storageRemote = NULL; TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); diff --git a/test/src/test.c b/test/src/test.c index c1a7ae92f..a5fdbb522 100644 --- a/test/src/test.c +++ b/test/src/test.c @@ -30,6 +30,7 @@ The test code is included directly so it can freely interact with the included C #include "common/harnessDebug.h" #include "common/harnessTest.h" +void testInit(void); void testContainerSet(bool testContainer); void testDataPathSet(const char *testDataPath); void testIdxSet(unsigned int testIdx); @@ -83,6 +84,7 @@ main(int argListSize, const char *argList[]) signal(SIGPIPE, SIG_IGN); // Set globals + testInit(); testExeSet(argList[0]); testProjectExeSet("{[C_TEST_PROJECT_EXE]}"); testContainerSet({[C_TEST_CONTAINER]}); diff --git a/test/test.pl b/test/test.pl index 730b1df81..efc7bca64 100755 --- a/test/test.pl +++ b/test/test.pl @@ -722,9 +722,7 @@ eval push(@{$oyProcess}, undef); } - executeTest( - ($strVm ne VM_NONE ? 'sudo ' : '') . "rm -rf ${strTestPath}/test-* ${strTestPath}/data-*" . - ($bDev ? '' : " ${strTestPath}/gcov-*")); + executeTest("rm -rf ${strTestPath}/test-* ${strTestPath}/data-*" . ($bDev ? '' : " ${strTestPath}/gcov-*")); $oStorageTest->pathCreate($strTestPath, {strMode => '0770', bIgnoreExists => true, bCreateParent => true}); # Remove old coverage dirs -- do it this way so the dirs stay open in finder/explorer, etc. @@ -913,11 +911,6 @@ eval #----------------------------------------------------------------------------------------------------------------------- if ($bLibCHostRequired || $bLibCVmRequired) { - if ($strVm eq VM_NONE) - { - confess &log(ASSERT, "c library build not yet supported for vm=none"); - } - my $strLibCPath = "${strVagrantPath}/bin"; # Loop through VMs to do the C Library builds @@ -936,7 +929,7 @@ eval foreach my $strBuildVM (@stryBuildVm) { my $strBuildPath = "${strLibCPath}/${strBuildVM}/libc"; - my $bContainerExists = $strBuildVM ne $strVmHost; + my $bContainerExists = $strBuildVM ne $strVmHost && $strBuildVM ne VM_NONE; my $strConfigOptions = (vmDebugIntegration($strBuildVM) ? ' --enable-test' : ''); my $strLibCSmart = "${strBuildPath}/blib/arch/auto/pgBackRest/LibC/LibC.so"; @@ -954,12 +947,6 @@ eval } } - # Delete old libc files from the host - if ($bRebuild) - { - executeTest('sudo rm -rf ' . $oVm->{$strBuildVM}{&VMDEF_PERL_ARCH_PATH} . '/auto/pgBackRest/LibC'); - } - if ($bRebuild) { &log(INFO, " build test library for ${strBuildVM} (${strBuildPath})"); @@ -1024,12 +1011,6 @@ eval { executeTest("docker rm -f test-build"); } - - if ($strBuildVM eq $strVmHost) - { - executeTest("sudo make -C ${strBuildPath} install", {bSuppressStdErr => true}); - buildLoadLibC(); - } } } } @@ -1065,7 +1046,7 @@ eval &log(INFO, 'package dependencies have changed, rebuilding...'); } - executeTest("sudo rm -rf ${strPackagePath}"); + executeTest("rm -rf ${strPackagePath}"); } # Loop through VMs to do the package builds @@ -1080,16 +1061,19 @@ eval { &log(INFO, "build package for ${strBuildVM} (${strBuildPath})"); - executeTest( - "docker run -itd -h test-build --name=test-build" . - " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", - {bSuppressStdErr => true}); + if ($strVm ne VM_NONE) + { + executeTest( + "docker run -itd -h test-build --name=test-build" . + " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", + {bSuppressStdErr => true}); + } $oStorageBackRest->pathCreate($strBuildPath, {bIgnoreExists => true, bCreateParent => true}); executeTest("rsync -r --exclude .vagrant --exclude .git ${strBackRestBase}/ ${strBuildPath}/"); executeTest( - "docker exec -i test-build " . + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . "bash -c 'cp -r /root/package-src/debian ${strBuildPath}' && sudo chown -R " . TEST_USER . " ${strBuildPath}"); @@ -1133,15 +1117,18 @@ eval ${$oStorageBackRest->get("${strBuildPath}/debian/changelog")}); executeTest( - "docker exec -i test-build " . + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . "bash -c 'cd ${strBuildPath} && debuild -i -us -uc -b'"); executeTest( - "docker exec -i test-build " . + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . "bash -c 'rm -f ${strPackagePath}/${strBuildVM}/*.build ${strPackagePath}/${strBuildVM}/*.changes" . " ${strPackagePath}/${strBuildVM}/pgbackrest-doc*'"); - executeTest("docker rm -f test-build"); + if ($strVm ne VM_NONE) + { + executeTest("docker rm -f test-build"); + } } if (!$oStorageBackRest->pathExists($strBuildPath) && $oVm->{$strBuildVM}{&VM_OS_BASE} eq VM_OS_BASE_RHEL) @@ -1149,10 +1136,13 @@ eval &log(INFO, "build package for ${strBuildVM} (${strBuildPath})"); # Create build container - executeTest( - "docker run -itd -h test-build --name=test-build" . - " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", - {bSuppressStdErr => true}); + if ($strVm ne VM_NONE) + { + executeTest( + "docker run -itd -h test-build --name=test-build" . + " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", + {bSuppressStdErr => true}); + } # Create build directories $oStorageBackRest->pathCreate($strBuildPath, {bIgnoreExists => true, bCreateParent => true}); @@ -1162,7 +1152,9 @@ eval $oStorageBackRest->pathCreate("${strBuildPath}/BUILD", {bIgnoreExists => true, bCreateParent => true}); # Install PostreSQL 11 development for package builds - executeTest("docker exec -i test-build bash -c 'yum install -y postgresql11-devel 2>&1'"); + executeTest( + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . + "bash -c 'yum install -y postgresql11-devel 2>&1'"); # Copy source files executeTest( @@ -1172,7 +1164,7 @@ eval # Copy package files executeTest( - "docker exec -i test-build bash -c '" . + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . "bash -c '" . "ln -s ${strBuildPath} /root/rpmbuild && " . "cp /root/package-src/pgbackrest.spec ${strBuildPath}/SPECS && " . "cp /root/package-src/*.patch ${strBuildPath}/SOURCES && " . @@ -1200,12 +1192,15 @@ eval # Build package executeTest( - "docker exec -i test-build rpmbuild --define 'pgmajorversion %{nil}' -v -bb --clean" . - " root/rpmbuild/SPECS/pgbackrest.spec", + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . + "rpmbuild --define 'pgmajorversion %{nil}' -v -bb --clean root/rpmbuild/SPECS/pgbackrest.spec", {bSuppressStdErr => true}); # Remove build container - executeTest("docker rm -f test-build"); + if ($strVm ne VM_NONE) + { + executeTest("docker rm -f test-build"); + } } } @@ -1311,7 +1306,7 @@ eval if (!defined($$oyProcess[$iVmIdx]) && $iTestIdx < @{$oyTestRun}) { my $oJob = new pgBackRestTest::Common::JobTest( - $oStorageTest, $strBackRestBase, $strTestPath, $$oyTestRun[$iTestIdx], $bDryRun, $bVmOut, + $oStorageTest, $strBackRestBase, $strTestPath, $$oyTestRun[$iTestIdx], $bDryRun, $strVmHost, $bVmOut, $iVmIdx, $iVmMax, $iTestIdx, $iTestMax, $strLogLevel, $strLogLevelTest, $bLogForce, $bShowOutputAsync, $bNoCleanup, $iRetry, !$bNoValgrind, !$bNoCoverage, $bCoverageSummary, !$bNoOptimize, $bBackTrace, $bProfile, $iScale, !$bNoDebug, $bDebugTestTrace, $iBuildMax / $iVmMax < 1 ? 1 : int($iBuildMax / $iVmMax)); @@ -1494,6 +1489,11 @@ eval ################################################################################################################################ # Runs tests ################################################################################################################################ + push( + @INC, + "${strBackRestBase}/test/.vagrant/bin/" . + ((testDefModuleTest($stryModule[0], $stryModuleTest[0]))->{&TESTDEF_CONTAINER} ? $strVm : $strVmHost) . + "/libc/blib/arch"); buildLoadLibC(); my $iRun = 0; @@ -1512,13 +1512,13 @@ eval $strPgVersion ne 'minimal' ? $strPgVersion: undef, # Pg version $stryModule[0], $stryModuleTest[0], \@iyModuleTestRun, # Module info $bVmOut, $bDryRun, $bNoCleanup, $bLogForce, # Test options - TEST_USER, BACKREST_USER, TEST_GROUP); # User/group info + TEST_USER, TEST_GROUP); # User/group info if (!$bNoCleanup) { if ($oHostGroup->removeAll() > 0) { - executeTest("sudo rm -rf ${strTestPath}"); + executeTest("rm -rf ${strTestPath}"); } } diff --git a/test/travis.pl b/test/travis.pl index a36ae8d7d..68db6c906 100755 --- a/test/travis.pl +++ b/test/travis.pl @@ -194,10 +194,6 @@ eval # Else run tests that require a container else { - processBegin("create backrest user"); - processExec("sudo adduser --ingroup=\${USER?} --uid=5001 --disabled-password --gecos \"\" " . BACKREST_USER); - processEnd(); - # Build the container processBegin("${strVm} build"); processExec("${strTestExe} --vm-build --vm=${strVm}", {bShowOutputAsync => true, bOutLogOnError => false});