-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Problem We want to be able to test how our infrastructure reacts on segfaults in Postgres (for example, we collect cores, and get some required logs/metrics, etc) ## Summary of changes - Add `trigger_segfauls` function to `neon_test_utils` to trigger a segfault in Postgres - Add `trigger_panic` function to `neon_test_utils` to trigger SIGABRT (by using `elog(PANIC, ...)) - Fix cleanup logic in regression tests in endpoint crashed
- Loading branch information
Showing
6 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# neon_test_utils extension | ||
comment = 'helpers for neon testing and debugging' | ||
default_version = '1.2' | ||
default_version = '1.3' | ||
module_pathname = '$libdir/neon_test_utils' | ||
relocatable = true | ||
trusted = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
from fixtures.neon_fixtures import NeonEnvBuilder | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"sql_func", | ||
[ | ||
"trigger_panic", | ||
"trigger_segfault", | ||
"💣", # calls `trigger_segfault` internally | ||
], | ||
) | ||
def test_endpoint_crash(neon_env_builder: NeonEnvBuilder, sql_func: str): | ||
""" | ||
Test that triggering crash from neon_test_utils crashes the endpoint | ||
""" | ||
env = neon_env_builder.init_start() | ||
env.neon_cli.create_branch("test_endpoint_crash") | ||
endpoint = env.endpoints.create_start("test_endpoint_crash") | ||
|
||
endpoint.safe_psql("CREATE EXTENSION neon_test_utils;") | ||
with pytest.raises(Exception, match="This probably means the server terminated abnormally"): | ||
endpoint.safe_psql(f"SELECT {sql_func}();") |
c9fd8d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3129 tests run: 3001 passed, 1 failed, 127 skipped (full report)
Failures on Postgres 14
test_basebackup_with_high_slru_count[github-actions-selfhosted-vectored-10-13-30]
: releaseFlaky tests (2)
Postgres 16
test_secondary_background_downloads
: releasetest_tenant_creation_fails
: debugCode coverage* (full report)
functions
:32.6% (6932 of 21275 functions)
lines
:50.0% (54485 of 108968 lines)
* collected from Rust tests only
c9fd8d7 at 2024-07-05T15:39:15.202Z :recycle: