Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/02-crud/11-sros-create-delete.robot
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Delete ConfigSet with orphan policy keeps device config on all targets - intent1
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SROS_NODES}
Wait Until Keyword Succeeds 15min 10s Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
END
kubectl apply ${CURDIR}/input/sros/customer.yaml
Wait Until Keyword Succeeds 2min 10s ConfigSet Check Ready ${SDCIO_RESOURCE_NAMESPACE} "customer"
Expand Down
2 changes: 1 addition & 1 deletion tests/02-crud/12-srl-create-delete.robot
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Delete ConfigSet with orphan policy keeps device config on all targets - intent1
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SRL_NODES}
Wait Until Keyword Succeeds 15min 10s Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
END
Initialize Intent Target Cache ${CURDIR}/input/srl -srl

Expand Down
2 changes: 1 addition & 1 deletion tests/02-crud/21-sros-update-replace.robot
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Replace And Verify intent4
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SROS_NODES}
Wait Until Keyword Succeeds 15min 10s Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
END
kubectl apply ${CURDIR}/input/sros/customer.yaml
Wait Until Keyword Succeeds 2min 10s ConfigSet Check Ready ${SDCIO_RESOURCE_NAMESPACE} "customer"
Expand Down
2 changes: 1 addition & 1 deletion tests/02-crud/22-srl-update-replace.robot
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Replace And Verify intent5
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SRL_NODES}
Wait Until Keyword Succeeds 15min 10s Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
END
FOR ${intent} IN @{SDCIO_CONFIGSET_INTENTS}
kubectl apply ${CURDIR}/input/srl/${intent}-srl.yaml
Expand Down
2 changes: 1 addition & 1 deletion tests/03-deviations/11-sros-revertive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Adjust SROS device config and Verify Revertive Deviations - intent4
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SROS_NODES}
Wait Until Keyword Succeeds 5min ${retry} Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node} timeout=5min retry=${retry}
END
kubectl apply ${CURDIR}/input/sros/customer.yaml
Wait Until Keyword Succeeds ${eventual_timeout} ${retry} ConfigSet Check Ready ${SDCIO_RESOURCE_NAMESPACE} "customer"
Expand Down
2 changes: 1 addition & 1 deletion tests/03-deviations/12-srl-revertive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Adjust SRL device config and Verify Revertive Deviations - intent5
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SRL_NODES}
Wait Until Keyword Succeeds 15min ${retry} Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node} retry=${retry}
END
FOR ${intent} IN @{SDCIO_CONFIGSET_INTENTS}
kubectl apply ${CURDIR}/input/srl/${intent}-srl.yaml
Expand Down
2 changes: 1 addition & 1 deletion tests/03-deviations/21-sros-nonrevertive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Partially Revert Deviations by Filter Path and Verify remaining deviations - int
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SROS_NODES}
Wait Until Keyword Succeeds 15min 10s Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
END
kubectl apply ${CURDIR}/input/sros/customer.yaml
Wait Until Keyword Succeeds
Expand Down
2 changes: 1 addition & 1 deletion tests/03-deviations/22-srl-nonrevertive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Partially Revert Deviations by Filter Path and Verify remaining deviations - int
Setup
Run echo 'setup executed'
FOR ${node} IN @{SDCIO_SRL_NODES}
Wait Until Keyword Succeeds 15min ${retry} Targets Check Ready ${SDCIO_RESOURCE_NAMESPACE} ${node}
Wait Until Target Ready ${SDCIO_RESOURCE_NAMESPACE} ${node} retry=${retry}
END
FOR ${intent} IN @{SDCIO_CONFIGSET_INTENTS}
kubectl apply ${CURDIR}/input/srl/${intent}-srl.yaml
Expand Down
28 changes: 28 additions & 0 deletions tests/Keywords/targets.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*** Settings ***
Resource k8s/kubectl.robot
Resource ../variables.robot
Library RPA.JSON


Expand All @@ -14,6 +15,33 @@ Targets Check Ready
${status} = Get values from JSON ${json} $.conditions[*].status
Should be equal as strings ${status} ['True', 'True', 'True', 'True', 'True']

Wait Until Target Ready
[Documentation] Waits for a Target to report all conditions ready. On timeout, dumps
... discovery diagnostics (Target list, DiscoveryRule status, api-server logs) before
... failing with a clear message — instead of the opaque "1 != 0" a raw
... "Wait Until Keyword Succeeds" + "Should Be Equal As Strings" failure produces.
... Common root cause covered by this: the Target CR is never created at all
... (discovery never finds the device) rather than being created-but-not-ready;
... the diagnostics below distinguish the two.
[Arguments] ${namespace} ${node} ${timeout}=15min ${retry}=10s
${ready} = Run Keyword And Return Status
... Wait Until Keyword Succeeds ${timeout} ${retry} Targets Check Ready ${namespace} ${node}
IF not ${ready}
Log Target discovery diagnostics ${namespace} ${node}
Fail Target '${node}' not ready within ${timeout} - see discovery diagnostics above (logged at WARN)
END

Log Target discovery diagnostics
[Documentation] Best-effort snapshot of discovery/target state when a Target fails to
... become ready in time. Logged at WARN so it is visible without verbose mode.
[Arguments] ${namespace} ${node}
Log === Target/Discovery diagnostics for '${node}' === WARN
Kubectl log diagnostic get targets.config.sdcio.dev -n ${namespace} -o wide
Kubectl log diagnostic get targets.config.sdcio.dev ${node} -n ${namespace} -o yaml
Kubectl log diagnostic get discoveryrules.inv.sdcio.dev -n ${namespace} -o yaml
Kubectl log diagnostic get pods -n ${SDCIO_SYSTEM_NAMESPACE} -o wide
Kubectl log diagnostic logs deployment/api-server -n ${SDCIO_SYSTEM_NAMESPACE} -c api-server --tail=500

Target Check Ready With Profiles
[Documentation] Make sure the discovered Target is ready and uses the expected connection and sync profiles
[Arguments] ${namespace} ${node} ${connection_profile} ${sync_profile}
Expand Down