Skip to content

Commit

Permalink
Improved robustness of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Nov 16, 2023
1 parent 246f9ba commit 8c7e316
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,13 @@ Describe 'Module tests' -Tag 'Module' {
}
$implementedSchema = $templateFileContentBicep[$implementedSchemaStartIndex..$implementedSchemaEndIndex]

$expectedSchemaFull = (Invoke-WebRequest -Uri $expectedUdtUrl).Content -split '\n'
try {
$expectedSchemaFull = (Invoke-WebRequest -Uri $expectedUdtUrl).Content -split '\n'
} catch {
Write-Warning "Failed to fetch schema from [$expectedUdtUrl]. Skipping schema check"
return
}

$expectedSchemaStartIndex = $expectedSchemaFull.IndexOf("type $udtName = {")
$expectedSchemaEndIndex = $expectedSchemaStartIndex + 1
while ($expectedSchemaFull[$expectedSchemaEndIndex] -notmatch '^\}.*' -and $expectedSchemaEndIndex -lt $expectedSchemaFull.Length) {
Expand Down

0 comments on commit 8c7e316

Please sign in to comment.