Skip to content

Commit 1586185

Browse files
committed
made changes as per Alek's suggestions
1 parent 269e7a3 commit 1586185

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/powershell/tests/Test-Assessment.41210.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ function Test-Assessment-41210 {
144144
try {
145145
$rawMetrics = @(Invoke-ZtAzureRequest -Path $tiMetricsPath -ErrorAction Stop)
146146
# A non-empty response must contain properties.sourceMetrics; absence is an unexpected shape.
147-
$schemaOk = ($rawMetrics.Count -eq 0) -or ($null -ne $rawMetrics[0].properties -and $null -ne $rawMetrics[0].properties.sourceMetrics)
147+
# Reject the entire response if any item is missing the documented structure.
148+
$schemaOk = ($rawMetrics.Count -eq 0) -or (($rawMetrics | Where-Object { $null -eq $_.properties -or $null -eq $_.properties.sourceMetrics }).Count -eq 0)
148149
if ($schemaOk) {
149150
$metricsByWorkspace[$workspace.WorkspaceId] = $rawMetrics
150151
$metricsOkByWorkspace[$workspace.WorkspaceId] = $true

0 commit comments

Comments
 (0)