diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c3ad8956..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build Probackup - -on: - push: - branches: - - "**" - # Runs triggered by pull requests are disabled to prevent executing potentially unsafe code from public pull requests - # pull_request: - # branches: - # - main - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - - build-win2019: - - runs-on: - - windows-2019 - - env: - zlib_dir: C:\dep\zlib - - steps: - - - uses: actions/checkout@v2 - - - name: Install pacman packages - run: | - $env:PATH += ";C:\msys64\usr\bin" - pacman -S --noconfirm --needed bison flex - - - name: Make zlib - run: | - git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib.git - cd zlib - cmake -DCMAKE_INSTALL_PREFIX:PATH=C:\dep\zlib -G "Visual Studio 16 2019" . - cmake --build . --config Release --target ALL_BUILD - cmake --build . --config Release --target INSTALL - copy C:\dep\zlib\lib\zlibstatic.lib C:\dep\zlib\lib\zdll.lib - copy C:\dep\zlib\bin\zlib.dll C:\dep\zlib\lib - - - name: Get Postgres sources - run: git clone -b REL_14_STABLE https://github.com/postgres/postgres.git - - # Copy ptrack to contrib to build the ptrack extension - # Convert line breaks in the patch file to LF otherwise the patch doesn't apply - - name: Get Ptrack sources - run: | - git clone -b master --depth 1 https://github.com/postgrespro/ptrack.git - Copy-Item -Path ptrack -Destination postgres\contrib -Recurse - (Get-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Raw).Replace("`r`n","`n") | Set-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Force -NoNewline - cd postgres - git apply -3 ../ptrack/patches/REL_14_STABLE-ptrack-core.diff - - - name: Build Postgres - run: | - $env:PATH += ";C:\msys64\usr\bin" - cd postgres\src\tools\msvc - (Get-Content config_default.pl) -Replace "zlib *=>(.*?)(?=,? *#)", "zlib => '${{ env.zlib_dir }}'" | Set-Content config.pl - cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && .\build.bat" - - - name: Build Probackup - run: cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && perl .\gen_probackup_project.pl `"${{ github.workspace }}`"\postgres" - - - name: Install Postgres - run: | - cd postgres - src\tools\msvc\install.bat postgres_install - - - name: Install Testgres - run: | - git clone -b no-port-for --single-branch --depth 1 https://github.com/postgrespro/testgres.git - pip3 install psycopg2 ./testgres - - # Grant the Github runner user full control of the workspace for initdb to successfully process the data folder - - name: Test Probackup - run: | - icacls.exe "${{ github.workspace }}" /grant "${env:USERNAME}:(OI)(CI)F" - $env:PATH += ";${{ github.workspace }}\postgres\postgres_install\lib;${{ env.zlib_dir }}\lib" - $Env:LC_MESSAGES = "English" - $Env:PG_CONFIG = "${{ github.workspace }}\postgres\postgres_install\bin\pg_config.exe" - $Env:PGPROBACKUPBIN = "${{ github.workspace }}\postgres\Release\pg_probackup\pg_probackup.exe" - $Env:PG_PROBACKUP_PTRACK = "ON" - If (!$Env:MODE -Or $Env:MODE -Eq "basic") { - $Env:PG_PROBACKUP_TEST_BASIC = "ON" - python -m unittest -v tests - python -m unittest -v tests.init_test - } else { - python -m unittest -v tests.$Env:MODE - } - diff --git a/.travis.yml b/.travis.yml index 074ae3d0..d774e48e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ os: linux -dist: jammy +dist: noble language: c @@ -63,17 +63,21 @@ notifications: # Default MODE is basic, i.e. all tests with PG_PROBACKUP_TEST_BASIC=ON env: - - PG_VERSION=16 PG_BRANCH=master PTRACK_PATCH_PG_BRANCH=master + - PG_VERSION=19 PG_BRANCH=master PTRACK_PATCH_PG_BRANCH=master + - PG_VERSION=18 PG_BRANCH=REL_18_STABLE PTRACK_PATCH_PG_BRANCH=REL_18_STABLE + - PG_VERSION=18 PG_BRANCH=REL_18_STABLE PTRACK_PATCH_PG_BRANCH=REL_18_STABLE MODE=full + - PG_VERSION=17 PG_BRANCH=REL_17_STABLE PTRACK_PATCH_PG_BRANCH=REL_17_STABLE + - PG_VERSION=16 PG_BRANCH=REL_16_STABLE PTRACK_PATCH_PG_BRANCH=REL_16_STABLE - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=REL_15_STABLE - PG_VERSION=14 PG_BRANCH=REL_14_STABLE PTRACK_PATCH_PG_BRANCH=REL_14_STABLE - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE - - PG_VERSION=12 PG_BRANCH=REL_12_STABLE PTRACK_PATCH_PG_BRANCH=REL_12_STABLE - - PG_VERSION=11 PG_BRANCH=REL_11_STABLE PTRACK_PATCH_PG_BRANCH=REL_11_STABLE - - PG_VERSION=10 PG_BRANCH=REL_10_STABLE - - PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE - - PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE - - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup - - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup_stream +# - PG_VERSION=12 PG_BRANCH=REL_12_STABLE PTRACK_PATCH_PG_BRANCH=REL_12_STABLE +# - PG_VERSION=11 PG_BRANCH=REL_11_STABLE PTRACK_PATCH_PG_BRANCH=REL_11_STABLE +# - PG_VERSION=10 PG_BRANCH=REL_10_STABLE +# - PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE +# - PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE +# - PG_VERSION=18 PG_BRANCH=REL_18_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup +# - PG_VERSION=18 PG_BRANCH=REL_18_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup_stream # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=checkdb @@ -92,7 +96,8 @@ env: jobs: allow_failures: - if: env(PG_BRANCH) = master - - if: env(PG_BRANCH) = REL9_5_STABLE + - if: env(MODE) = full + # - if: env(PG_BRANCH) = REL9_5_STABLE # - if: env(MODE) IN (archive, backup, delta, locking, merge, replica, retention, restore) # Only run CI for master branch commits to limit our travis usage diff --git a/tests/cfs_backup_test.py b/tests/cfs_backup_test.py index fb4a6c6b..fed60643 100644 --- a/tests/cfs_backup_test.py +++ b/tests/cfs_backup_test.py @@ -1104,7 +1104,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase): list_data_files = find_by_pattern( [self.get_tblspace_path(self.node, tblspace_name)], - '^.*/\d+$') + r'^.*/\d+$') self.assertTrue( list_data_files, "ERROR: Files of data not found into tablespace dir" @@ -1166,7 +1166,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase): list_data_files = find_by_pattern( [self.get_tblspace_path(self.node, tblspace_name)], - '^.*/\d+$') + r'^.*/\d+$') self.assertTrue( list_data_files, "ERROR: Files of data not found into tablespace dir" diff --git a/tests/delete_test.py b/tests/delete_test.py index 10100887..40ab74c8 100644 --- a/tests/delete_test.py +++ b/tests/delete_test.py @@ -486,7 +486,7 @@ class DeleteTest(ProbackupTest, unittest.TestCase): # @unittest.skip("skip") def test_delete_multiple_descendants(self): - """ + r""" PAGEb3 | PAGEa3 PAGEb2 / @@ -654,7 +654,7 @@ class DeleteTest(ProbackupTest, unittest.TestCase): # @unittest.skip("skip") def test_delete_multiple_descendants_dry_run(self): - """ + r""" PAGEa3 PAGEa2 / \ / diff --git a/tests/false_positive_test.py b/tests/false_positive_test.py index ea82cb18..77f2226c 100644 --- a/tests/false_positive_test.py +++ b/tests/false_positive_test.py @@ -214,6 +214,7 @@ class FalsePositive(ProbackupTest, unittest.TestCase): @y.sokolov: looks like this test should pass. So I commented 'expectedFailure' """ + self._check_gdb_flag_or_skip_test() backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup') node = self.make_simple_node( base_dir=os.path.join(self.module_name, self.fname, 'node'), diff --git a/tests/incr_restore_test.py b/tests/incr_restore_test.py index 1c8f49e8..6fb9cd0e 100644 --- a/tests/incr_restore_test.py +++ b/tests/incr_restore_test.py @@ -2429,7 +2429,7 @@ class IncrRestoreTest(ProbackupTest, unittest.TestCase): """ Check that failed incremental restore can be restarted """ - self._check_gdb_flag_or_skip_test + self._check_gdb_flag_or_skip_test() node = self.make_simple_node('node', set_replication=True, initdb_params=['--data-checksums']) diff --git a/tests/merge_test.py b/tests/merge_test.py index 1d40af7f..82af3627 100644 --- a/tests/merge_test.py +++ b/tests/merge_test.py @@ -1950,7 +1950,7 @@ class MergeTest(ProbackupTest, unittest.TestCase): # @unittest.skip("skip") def test_merge_multiple_descendants(self): - """ + r""" PAGEb3 | PAGEa3 PAGEb2 / diff --git a/tests/restore_test.py b/tests/restore_test.py index b6664252..7b3b6755 100644 --- a/tests/restore_test.py +++ b/tests/restore_test.py @@ -3866,7 +3866,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase): """ Check that partially restored PostgreSQL instance cannot be started """ - self._check_gdb_flag_or_skip_test + self._check_gdb_flag_or_skip_test() node = self.make_simple_node('node', set_replication=True, initdb_params=['--data-checksums']) diff --git a/tests/retention_test.py b/tests/retention_test.py index cf422fe0..0c426416 100644 --- a/tests/retention_test.py +++ b/tests/retention_test.py @@ -714,7 +714,7 @@ class RetentionTest(ProbackupTest, unittest.TestCase): # @unittest.skip("skip") def test_basic_window_merge_multiple_descendants(self): - """ + r""" PAGEb3 | PAGEa3 -----------------------------retention window @@ -970,7 +970,7 @@ class RetentionTest(ProbackupTest, unittest.TestCase): # @unittest.skip("skip") def test_basic_window_merge_multiple_descendants_1(self): - """ + r""" PAGEb3 | PAGEa3 -----------------------------retention window diff --git a/travis/install.sh b/travis/install.sh index 43ada47b..5f85b0cb 100755 --- a/travis/install.sh +++ b/travis/install.sh @@ -39,6 +39,11 @@ cd postgres # Go to postgres dir if [ "$PG_PROBACKUP_PTRACK" = "ON" ]; then git apply -3 contrib/ptrack/patches/${PTRACK_PATCH_PG_BRANCH}-ptrack-core.diff fi + +if [ "$PG_BRANCH" = "REL_18_STABLE" ]; then + git apply -3 ../patches/${PG_BRANCH}_pg_probackup.patch +fi + CC='ccache gcc' CFLAGS="-Og" ./configure --prefix=$PGHOME \ --cache-file=~/.ccache/configure-cache \ --enable-debug --enable-cassert --enable-depend \ @@ -63,4 +68,4 @@ if [ ! -d "contrib/amcheck" ]; then make -C contrib/amcheck install fi -pip3 install testgres \ No newline at end of file +pip3 install -r ../tests/requirements.txt \ No newline at end of file diff --git a/travis/script.sh b/travis/script.sh index 31ef0972..daf4a36e 100755 --- a/travis/script.sh +++ b/travis/script.sh @@ -21,6 +21,10 @@ if [ -z ${PGPROBACKUP_GDB+x} ]; then PGPROBACKUP_GDB=ON fi +if [ -z ${PG_PROBACKUP_PTRACK+x} ]; then + PG_PROBACKUP_PTRACK=ON +fi + echo "############### Testing:" echo PG_PROBACKUP_PARANOIA=${PG_PROBACKUP_PARANOIA} echo ARCHIVE_COMPRESSION=${ARCHIVE_COMPRESSION} @@ -30,12 +34,20 @@ echo PGPROBACKUP_SSH_REMOTE=${PGPROBACKUP_SSH_REMOTE} echo PGPROBACKUP_GDB=${PGPROBACKUP_GDB} echo PG_PROBACKUP_PTRACK=${PG_PROBACKUP_PTRACK} +#Run Full tests only if FULL_TESTS=ON e.g. for master branch +if [ "$MODE" = "full" ] && [ -z ${FULL_TESTS} ]; then + exit +fi + if [ "$MODE" = "basic" ]; then export PG_PROBACKUP_TEST_BASIC=ON echo PG_PROBACKUP_TEST_BASIC=${PG_PROBACKUP_TEST_BASIC} - python3 -m unittest -v tests - python3 -m unittest -v tests.init_test + python3 -m pytest -v -n4 -k "test_basic" + python3 -m pytest -v -n4 -k "init_test.py" +elif [ "$MODE" = "full" ]; then + echo PG_PROBACKUP_TEST_BASIC=${PG_PROBACKUP_TEST_BASIC} + python3 -m pytest -v -n4 else echo PG_PROBACKUP_TEST_BASIC=${PG_PROBACKUP_TEST_BASIC} - python3 -m unittest -v tests.$MODE + python3 -m pytest -v -n4 -k "$MODE" fi