Aiven-Open / pghoard

PostgreSQL® backup and restore service
http://aiven-open.github.io/pghoard/
Apache License 2.0
1.3k stars 99 forks source link

test: fix flaky test_pause_on_disk_full [BF-1609] #580

Closed kathia-barahona closed 1 year ago

kathia-barahona commented 1 year ago

About this change - What it does

Makes test wait for pg_receivewal to start streaming.

Resolves: #BF-1609

Why this way

This change is mainly related on waiting for pg_receivewal process to be actually spawned. Noticed that we might ran into a race condition where the test generates the WAL files before the service actually starts streaming.

That's why currently, pg_receivewal starts log streaming at 0/2000000 instead of 0/1000000, which probably means pg_receivewal found a segmented file when initially scanning the WAL dir (this shouldn't happen since the test starts with an empty dir). Noticed that the test always fails when the streaming starts at 0/3000000, meaning that the latest segment was 0/2000000 and it was not compressed, that's why AssertionError: Expected at least 15 xlog uploads, got 14 is raised.

codecov[bot] commented 1 year ago

Codecov Report

Merging #580 (6afea46) into main (33b6e59) will decrease coverage by 0.03%. The diff coverage is n/a.

:exclamation: Current head 6afea46 differs from pull request most recent head 1dfac7d. Consider uploading reports for the commit 1dfac7d to get more accurate results

Additional details and impacted files [![Impacted file tree graph](https://codecov.io/gh/aiven/pghoard/pull/580/graphs/tree.svg?width=650&height=150&src=pr&token=nLr7M7hvCx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiven)](https://codecov.io/gh/aiven/pghoard/pull/580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiven) ```diff @@ Coverage Diff @@ ## main #580 +/- ## ========================================== - Coverage 91.37% 91.35% -0.03% ========================================== Files 32 32 Lines 4671 4671 ========================================== - Hits 4268 4267 -1 - Misses 403 404 +1 ``` | [Impacted Files](https://codecov.io/gh/aiven/pghoard/pull/580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiven) | Coverage Δ | | |---|---|---| | [pghoard/pghoard.py](https://codecov.io/gh/aiven/pghoard/pull/580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiven#diff-cGdob2FyZC9wZ2hvYXJkLnB5) | `84.86% <0.00%> (-0.17%)` | :arrow_down: |