Skip to content

Commit 6af41fd

Browse files
AndrewAndrew
authored andcommitted
fix(postgres): constrain Aurora 17 buffercache skip test to Postgres 17+
The test was failing on Postgres 10-16 because load_version() overwrites check.version during check.run(). Changed @requires_over_10 to @requires_over_17 so the test only runs where the actual version satisfies the skip condition.
1 parent d547b4f commit 6af41fd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

postgres/tests/test_pg_integration.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
import mock
99
import psycopg
1010
import pytest
11-
1211
from datadog_checks.postgres import PostgreSql
1312
from datadog_checks.postgres.__about__ import __version__
1413
from datadog_checks.postgres.util import BUFFERCACHE_METRICS, DatabaseHealthCheckError, PartialFormatter, fmt
15-
from datadog_checks.postgres.version_utils import V17
1614

1715
from .common import (
1816
COMMON_METRICS,
@@ -57,6 +55,7 @@
5755
requires_over_10,
5856
requires_over_14,
5957
requires_over_16,
58+
requires_over_17,
6059
run_one_check,
6160
run_vacuum_thread,
6261
)
@@ -394,7 +393,7 @@ def test_buffercache_metrics(aggregator, integration_check, pg_instance):
394393
aggregator.assert_metric(unused_metric, count=1, tags=unused_buffers_tags)
395394

396395

397-
@requires_over_10
396+
@requires_over_17
398397
def test_buffercache_metrics_skipped_on_aurora_17(aggregator, integration_check, pg_instance):
399398
"""
400399
Aurora PostgreSQL 17+ crashes with Bus Error when querying pg_buffercache.
@@ -405,8 +404,8 @@ def test_buffercache_metrics_skipped_on_aurora_17(aggregator, integration_check,
405404
check = integration_check(pg_instance)
406405

407406
# Simulate Aurora PostgreSQL 17+
407+
# Note: is_aurora must be set before run() since initialize_is_aurora() only sets it if None
408408
check.is_aurora = True
409-
check.version = V17
410409

411410
check.run()
412411

0 commit comments

Comments
 (0)