Skip to content

Commit bbe2531

Browse files
wu-shengclaude
andcommitted
fix(test): confirm the seed segment is registered before the concurrent pair
The reporter thread delivers with up to ~20ms poll latency while the test body fires /users milliseconds after prepare, so on slow runners the /ping seed could still be in flight together with both /users reports and lose the collector's first-insert race itself. Poll /receiveData (read- only) until the seed is registered before triggering the concurrent reports. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 853e7b0 commit bbe2531

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/plugin/web/sw_fork_support/test_fork_support.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17+
import time
1718
from typing import Callable
1819

1920
import pytest
@@ -43,6 +44,16 @@ class TestPlugin(TestPluginBase):
4344

4445
@pytest.mark.parametrize('version', ['grpcio>=1.83'])
4546
def test_plugin(self, docker_compose, version):
47+
# the /ping seed segment must be REGISTERED by the collector before /users makes
48+
# the parent and child report concurrently, otherwise all three segments can be
49+
# in flight together and the collector's first-insert race still drops one
50+
for _ in range(30):
51+
if '/ping' in requests.get('http://localhost:12800/receiveData', timeout=5).text:
52+
break
53+
time.sleep(1)
54+
else:
55+
raise Exception('the /ping seed segment never reached the collector')
56+
4657
response = requests.get('http://0.0.0.0:9090/users', timeout=5)
4758
assert response.status_code == 200
4859

0 commit comments

Comments
 (0)