Skip to content

Commit 7235fa9

Browse files
authored
WaitFor riak e2e to populate before starting (DataDog#23216)
* update riak e2e * add return value to populate
1 parent e1913b0 commit 7235fa9

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

riak/tests/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
import requests
1010

1111
from datadog_checks.dev import docker_run
12-
from datadog_checks.dev.conditions import CheckEndpoints
12+
from datadog_checks.dev.conditions import CheckEndpoints, WaitFor
1313
from datadog_checks.riak import Riak
1414

1515
from . import common
1616

1717

1818
def populate():
19-
requests.post(
19+
post = requests.post(
2020
"{}/riak/bucket/german".format(common.BASE_URL),
2121
headers={"Content-Type": "text/plain"},
2222
data='herzlich willkommen',
2323
)
24-
requests.get("{}/riak/bucket/german".format(common.BASE_URL))
24+
get = requests.get("{}/riak/bucket/german".format(common.BASE_URL))
25+
return post.ok and get.ok
2526

2627

2728
@pytest.fixture(scope="session")
@@ -30,7 +31,7 @@ def dd_environment():
3031
with docker_run(
3132
compose_file=os.path.join(common.HERE, 'compose', 'riak.yaml'),
3233
env_vars=env,
33-
conditions=[CheckEndpoints(['{}/riak/bucket'.format(common.BASE_URL)]), populate],
34+
conditions=[CheckEndpoints(['{}/riak/bucket'.format(common.BASE_URL)]), WaitFor(populate)],
3435
sleep=10, # some stats require a bit of time before the test will capture them
3536
):
3637
yield common.INSTANCE

riak/tests/test_riak.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_check(aggregator, check, instance):
1919
sc_tags = tags + ['url:' + instance['url']]
2020

2121
for gauge in common.CHECK_GAUGES + common.CHECK_GAUGES_STATS:
22-
aggregator.assert_metric(gauge, tags=tags, count=2)
22+
aggregator.assert_metric(gauge, tags=tags, at_least=1)
2323

2424
aggregator.assert_service_check(common.SERVICE_CHECK_NAME, status=Riak.OK, tags=sc_tags)
2525

0 commit comments

Comments
 (0)