ci: cram: 110-prplmesh-dataelements: fix assert agent count per testbed

Currently the cram test fails to assert the correct connected agent
count as the previous change in commit c5824479fc ("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: c5824479fc ("ci: cram: 110-prplmesh-dataelements: assert agent count per testbed")
Signed-off-by: Petr Štetiar <petr.stetiar@prplfoundation.org>
This commit is contained in:
Petr Štetiar 2026-05-21 10:25:54 +02:00 committed by Hela Saadani
parent e893e4d4f2
commit 5c4d350c62
3 changed files with 17 additions and 3 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"