File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/sampler Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 3
3
import json
4
4
import logging
5
5
import os
6
+ import time
6
7
from importlib import reload
7
8
from logging import getLogger
8
9
from unittest import TestCase
@@ -186,7 +187,11 @@ def test_urls_excluded_from_sampling(self):
186
187
except requests .exceptions .RequestException :
187
188
pass
188
189
190
+ timeout = time .time () + 1
189
191
span_list = memory_exporter .get_finished_spans ()
192
+ while len (span_list ) != 1 and timeout > time .time ():
193
+ span_list = memory_exporter .get_finished_spans ()
194
+ time .sleep (0.1 )
190
195
self .assertEqual (1 , len (span_list ))
191
196
span_http_url = span_list [0 ].attributes .get ("http.url" )
192
197
self .assertEqual (span_http_url , "http://this_is_a_fake_url:3849/GetSamplingRules" )
@@ -196,7 +201,11 @@ def test_urls_excluded_from_sampling(self):
196
201
except requests .exceptions .RequestException :
197
202
pass
198
203
204
+ timeout = time .time () + 1
199
205
span_list = memory_exporter .get_finished_spans ()
206
+ while len (span_list ) != 2 and timeout > time .time ():
207
+ span_list = memory_exporter .get_finished_spans ()
208
+ time .sleep (0.1 )
200
209
self .assertEqual (2 , len (span_list ))
201
210
span_http_url = span_list [1 ].attributes .get ("http.url" )
202
211
self .assertEqual (span_http_url , "http://this_is_a_fake_url:3849/SamplingTargets" )
You can’t perform that action at this time.
0 commit comments