Skip to content

Commit

Permalink
Fix metadata instance test
Browse files Browse the repository at this point in the history
  • Loading branch information
edengorevoy committed Aug 16, 2023
1 parent 842f1f6 commit 892f1b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions postgres/tests/test_pg_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
check_wal_receiver_metrics,
requires_static_version,
)
from .utils import _get_conn, _get_superconn, requires_over_10, requires_over_14
from .utils import _get_conn, _get_superconn, requires_over_10, requires_over_14, run_one_check

CONNECTION_METRICS = ['postgresql.max_connections', 'postgresql.percent_usage_connections']

Expand Down Expand Up @@ -613,6 +613,7 @@ def test_correct_hostname(dbm_enabled, reported_hostname, expected_hostname, agg
)


# @pytest.mark.skip(reason='debugging flaky test (2023--03)')
@pytest.mark.parametrize(
'dbm_enabled, reported_hostname',
[
Expand All @@ -624,14 +625,14 @@ def test_correct_hostname(dbm_enabled, reported_hostname, expected_hostname, agg
)
@pytest.mark.integration
@pytest.mark.usefixtures('dd_environment')
def test_database_instance_metadata(aggregator, dd_run_check, pg_instance, dbm_enabled, reported_hostname):
def test_database_instance_metadata(aggregator, pg_instance, dbm_enabled, reported_hostname):
pg_instance['dbm'] = dbm_enabled
if reported_hostname:
pg_instance['reported_hostname'] = reported_hostname
expected_host = reported_hostname if reported_hostname else 'stubbed.hostname'
expected_tags = pg_instance['tags'] + ['port:{}'.format(pg_instance['port'])]
check = PostgreSql('test_instance', {}, [pg_instance])
dd_run_check(check)
run_one_check(check, pg_instance)

dbm_metadata = aggregator.get_event_platform_events("dbm-metadata")
event = next((e for e in dbm_metadata if e['kind'] == 'database_instance'), None)
Expand All @@ -648,7 +649,7 @@ def test_database_instance_metadata(aggregator, dd_run_check, pg_instance, dbm_e

# Run a second time and expect the metadata to not be emitted again because of the cache TTL
aggregator.reset()
dd_run_check(check)
run_one_check(check, pg_instance)

dbm_metadata = aggregator.get_event_platform_events("dbm-metadata")
event = next((e for e in dbm_metadata if e['kind'] == 'database_instance'), None)
Expand Down

0 comments on commit 892f1b8

Please sign in to comment.