99from . import common
1010
1111
12+ def _assert_nginx_metrics (aggregator ):
13+ for m in ('nginx.net.conn_dropped_per_s' , 'nginx.net.conn_opened_per_s' , 'nginx.net.request_per_s' ):
14+ aggregator .assert_metric (m , at_least = 1 )
15+ for m in ('nginx.net.writing' , 'nginx.net.reading' , 'nginx.net.waiting' , 'nginx.net.connections' ):
16+ aggregator .assert_metric (m , at_least = 1 )
17+ aggregator .assert_service_check ('nginx.can_connect' , status = Nginx .OK )
18+
19+
1220@pytest .mark .e2e
1321@pytest .mark .skipif (common .USING_VTS , reason = "Non-VTS test" )
1422def test_e2e (dd_agent_check , instance ):
@@ -18,21 +26,15 @@ def test_e2e(dd_agent_check, instance):
1826 aggregator .assert_metric (m , count = 1 , tags = common .TAGS_WITH_HOST_AND_PORT )
1927 for m in ('nginx.net.writing' , 'nginx.net.reading' , 'nginx.net.waiting' , 'nginx.net.connections' ):
2028 aggregator .assert_metric (m , count = 2 , tags = common .TAGS_WITH_HOST_AND_PORT )
21-
2229 aggregator .assert_service_check ('nginx.can_connect' , status = Nginx .OK , tags = common .TAGS_WITH_HOST_AND_PORT )
30+ _assert_nginx_metrics (aggregator )
2331
2432
2533@pytest .mark .e2e
2634@pytest .mark .skipif (common .USING_VTS , reason = "Non-VTS test" )
2735def test_e2e_discovery (dd_agent_check_discovery ):
2836 aggregator = dd_agent_check_discovery (check_rate = True )
29-
30- for m in ('nginx.net.conn_dropped_per_s' , 'nginx.net.conn_opened_per_s' , 'nginx.net.request_per_s' ):
31- aggregator .assert_metric (m , at_least = 1 )
32- for m in ('nginx.net.writing' , 'nginx.net.reading' , 'nginx.net.waiting' , 'nginx.net.connections' ):
33- aggregator .assert_metric (m , at_least = 1 )
34-
35- aggregator .assert_service_check ('nginx.can_connect' , status = Nginx .OK )
37+ _assert_nginx_metrics (aggregator )
3638
3739
3840@pytest .mark .e2e
0 commit comments