From 5c4d350c62cb2bcc16ea5885723e92fa751a9e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 21 May 2026 10:25:54 +0200 Subject: [PATCH] ci: cram: 110-prplmesh-dataelements: fix assert agent count per testbed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the cram test fails to assert the correct connected agent count as the previous change in commit c5824479fcf0 ("ci: cram: 110-prplmesh-dataelements: assert agent count per testbed") was pushed by accident without being properly tested. The output of prplmesh_cli prefixes the line containing the connected agent count with a tab character, meaning there is no literal space character before the digit. Since the sed regex pattern requires a literal space, the pattern match fails, leaving the extracted agent count empty. --- .gitlab/tests/cram/wnc-freedom/110-prplmesh-dataelements.t +++ .gitlab/tests/cram/wnc-freedom/110-prplmesh-dataelements.t.err @@ -215,6 +215,7 @@ > | sed -nE 's/.* ([0-9]+) agent\(s\) connected.*/\1/p') $ if echo "$CI_RUNNER_DESCRIPTION" | grep -q testbed-02; then EXP=2; else EXP=1; fi $ test "$ACT" = "$EXP" || echo "agent count mismatch: actual=$ACT expected=$EXP" + agent count mismatch: actual= expected=2 So lets fix this by replacing the sed extraction pattern with a simpler awk command, which has been verified locally on OSPv2. Since awk's default field separator handles whitespace (both spaces and tabs) uniformly, it successfully extracts the agent count. Apply the same per-testbed agent-count assertion to the OSPv2 (mxl25641-hdk-6) and arcadyan-mozart boards, which had the count hardcoded to 1 and thus hit the identical failure on testbed-02 where prplmesh_cli now reports 2 connected agents (HomePlug-backhauled TL-WPA7817, PCF-2504): --- .gitlab/tests/cram/mxl25641-hdk-6/110-prplmesh-dataelements.t +++ .gitlab/tests/cram/mxl25641-hdk-6/110-prplmesh-dataelements.t.err @@ -179,7 +179,7 @@ Mode: Agent+Controller Controller: bridge MAC: (4C:BA:7D|A8:C2:46|AC:9A:96):[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2} (re) - 1 agent(s) connected + 2 agent(s) connected Fixes: PCF-2578 Closes: PPW-1981 References: PCF-2504 Assisted-by: claude:opus-4-8:1m-context Link: https://gitlab.com/prpl-foundation/prplos/prplos/-/jobs/14374275747#L951 Link: https://gitlab.com/prpl-foundation/prplos/prplos/-/jobs/14527766714#L955 Fixes: c5824479fcf0 ("ci: cram: 110-prplmesh-dataelements: assert agent count per testbed") Signed-off-by: Petr Štetiar --- .../cram/arcadyan-mozart/110-prplmesh-dataelements.t | 9 ++++++++- .../cram/mxl25641-hdk-6/110-prplmesh-dataelements.t | 9 ++++++++- .../tests/cram/wnc-freedom/110-prplmesh-dataelements.t | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitlab/tests/cram/arcadyan-mozart/110-prplmesh-dataelements.t b/.gitlab/tests/cram/arcadyan-mozart/110-prplmesh-dataelements.t index 8aad85138d..05145257c9 100644 --- a/.gitlab/tests/cram/arcadyan-mozart/110-prplmesh-dataelements.t +++ b/.gitlab/tests/cram/arcadyan-mozart/110-prplmesh-dataelements.t @@ -195,7 +195,7 @@ Check that prplmesh is operational: Mode: Agent+Controller Controller: bridge MAC: [0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2} (re) - 1 agent(s) connected + [1-9]+ agent\(s\) connected (re) Agent: MAC address: [0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2} (re) management mode: Multi-AP-Controller-and-Agent @@ -215,6 +215,13 @@ Check that prplmesh is operational: current state: OPERATIONAL best state: OPERATIONAL +Assert agent count matches testbed topology (testbed-01: 1, testbed-02: 2 with HomePlug-backhauled TL-WPA7817, see PCF-2504): + + $ ACT=$(R "/opt/prplmesh/bin/prplmesh_cli -c status -o pretty" \ + > | awk '/agent\(s\) connected/ {print $1}') + $ if echo "$CI_RUNNER_DESCRIPTION" | grep -q testbed-02; then EXP=2; else EXP=1; fi + $ test "$ACT" = "$EXP" || echo "agent count mismatch: actual=$ACT expected=$EXP" + Check that controller received correct info about wifi subsystem: $ R logger -t cram "Check controller info about network" diff --git a/.gitlab/tests/cram/mxl25641-hdk-6/110-prplmesh-dataelements.t b/.gitlab/tests/cram/mxl25641-hdk-6/110-prplmesh-dataelements.t index 51697a5565..38c2e76105 100644 --- a/.gitlab/tests/cram/mxl25641-hdk-6/110-prplmesh-dataelements.t +++ b/.gitlab/tests/cram/mxl25641-hdk-6/110-prplmesh-dataelements.t @@ -179,7 +179,7 @@ Check that prplmesh is operational: Mode: Agent+Controller Controller: bridge MAC: (4C:BA:7D|A8:C2:46|AC:9A:96):[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2} (re) - 1 agent(s) connected + [1-9]+ agent\(s\) connected (re) Agent: MAC address: [0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2} (re) management mode: Multi-AP-Controller-and-Agent @@ -199,6 +199,13 @@ Check that prplmesh is operational: current state: OPERATIONAL best state: OPERATIONAL +Assert agent count matches testbed topology (testbed-01: 1, testbed-02: 2 with HomePlug-backhauled TL-WPA7817, see PCF-2504): + + $ ACT=$(R "/opt/prplmesh/bin/prplmesh_cli -c status -o pretty" \ + > | awk '/agent\(s\) connected/ {print $1}') + $ if echo "$CI_RUNNER_DESCRIPTION" | grep -q testbed-02; then EXP=2; else EXP=1; fi + $ test "$ACT" = "$EXP" || echo "agent count mismatch: actual=$ACT expected=$EXP" + Check that controller received correct info about wifi subsystem: $ R logger -t cram "Check controller info about network" diff --git a/.gitlab/tests/cram/wnc-freedom/110-prplmesh-dataelements.t b/.gitlab/tests/cram/wnc-freedom/110-prplmesh-dataelements.t index 6a0033f2f4..3d3d9eb75e 100644 --- a/.gitlab/tests/cram/wnc-freedom/110-prplmesh-dataelements.t +++ b/.gitlab/tests/cram/wnc-freedom/110-prplmesh-dataelements.t @@ -212,7 +212,7 @@ Check that prplmesh is operational: Assert agent count matches testbed topology (testbed-01: 1, testbed-02: 2 with HomePlug-backhauled TL-WPA7817, see PCF-2504): $ ACT=$(R "/opt/prplmesh/bin/prplmesh_cli -c status -o pretty" \ - > | sed -nE 's/.* ([0-9]+) agent\(s\) connected.*/\1/p') + > | awk '/agent\(s\) connected/ {print $1}') $ if echo "$CI_RUNNER_DESCRIPTION" | grep -q testbed-02; then EXP=2; else EXP=1; fi $ test "$ACT" = "$EXP" || echo "agent count mismatch: actual=$ACT expected=$EXP"