Skip to content

Commit 8609e3a

Browse files
committed
Fixing path issues in scripts. Added Standard as possible sku.
1 parent c654a77 commit 8609e3a

13 files changed

Lines changed: 87 additions & 24 deletions

.github/workflows/integration-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ on:
3333
required: true
3434
type: choice
3535
options:
36+
- Standard
3637
- StandardV2
3738
- Premium
3839
- PremiumV2

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ Desktop.ini
3939
.local-extract*/
4040

4141
# Files for integration tests
42-
tests/integration/all-resource-types/logs/**
43-
tests/integration/all-resource-types/extracted-artifacts*/**
44-
tests/integration/all-resource-types/target-apim.json
45-
tests/integration/all-resource-types/source-apim.json
46-
tests/integration/all-resource-types/source-apim-post-activation.bicep
42+
tests/integration/all-resource-types/**/logs/**
43+
tests/integration/all-resource-types/**/extracted-artifacts*/**
44+
tests/integration/all-resource-types/bicep/target-apim.json
45+
tests/integration/all-resource-types/bicep/source-apim.json
46+
tests/integration/all-resource-types/bicep/source-apim-post-activation.bicep
4747

4848
# Environment variables
4949
.env
@@ -57,4 +57,3 @@ tests/integration/all-resource-types/source-apim-post-activation.bicep
5757
# Squad: SubSquad activation file (local to this machine)
5858
.squad-workstream
5959
*.d.ts.map
60-
tests/integration/all-resource-types/source-apim-post-activation.json

tests/integration/all-resource-types/Test-ExtractedArtifact.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Path to expected-structure.json manifest file.
2222
2323
.PARAMETER SkuName
24-
APIM SKU name (StandardV2, Developer, Premium, PremiumV2) to handle SKU-variant
24+
APIM SKU name (StandardV2, Developer, Premium, Standard, PremiumV2) to handle SKU-variant
2525
resources. Default: StandardV2.
2626
2727
.EXAMPLE
@@ -239,7 +239,7 @@ function Invoke-DirectoryValidation([string]$basePath, [psobject]$dirSpec, [stri
239239

240240
# SKU filter check
241241
if (Test-SkuFilter $dirSpec $SkuName) {
242-
Write-Host " ⏭️ Skipping $label (SKU: requires $($dirSpec.skuFilter -join ', '))"
242+
Write-Host " ⏭️ Skipping $label (SKU: supported in $($dirSpec.skuFilter -join ', '))"
243243
return
244244
}
245245

@@ -357,7 +357,7 @@ Write-Host ""
357357
if ($manifest.workspaces) {
358358
$wsSpec = $manifest.workspaces
359359
if (Test-SkuFilter $wsSpec $SkuName) {
360-
Write-Host " ⏭️ Skipping workspaces (SKU: requires $($wsSpec.skuFilter -join ', '))"
360+
Write-Host " ⏭️ Skipping workspaces (SKU: supported in $($wsSpec.skuFilter -join ', '))"
361361
}
362362
elseif ($wsSpec.expected) {
363363
foreach ($ws in $wsSpec.expected) {

tests/integration/all-resource-types/bicep/source-apim.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ param publisherEmail string
2626
@description('Publisher name shown in the developer portal.')
2727
param publisherName string = 'APIOps BVT'
2828

29-
@description('APIM SKU name. Use StandardV2/PremiumV2 for v2 tiers, or Developer/Premium for classic.')
30-
@allowed(['Developer', 'Premium', 'StandardV2', 'PremiumV2'])
29+
@description('APIM SKU name. Use StandardV2/PremiumV2 for v2 tiers, or Developer/Premium/Standard for classic.')
30+
@allowed(['Developer', 'Premium', 'Standard', 'StandardV2', 'PremiumV2'])
3131
param skuName string = 'StandardV2'
3232

3333
@description('Application Insights name for logger/diagnostic testing.')
@@ -46,7 +46,7 @@ param logAnalyticsName string = 'bvt-${uniqueString(resourceGroup().id)}-src-law
4646
// Variables
4747
// ---------------------------------------------------------------------------
4848

49-
var isClassicSku = skuName == 'Developer' || skuName == 'Premium'
49+
var isClassicSku = skuName == 'Developer' || skuName == 'Premium' || skuName == 'Standard'
5050
var apimSkuCapacity = isClassicSku ? 1 : 1
5151
var supportsSelfHostedGateway = isClassicSku
5252
var supportsWorkspaces = skuName == 'Premium' || skuName == 'PremiumV2'

tests/integration/all-resource-types/bicep/target-apim.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ param publisherEmail string
3030
param publisherName string = 'APIOps BVT'
3131

3232
@description('APIM SKU name. Must match the source instance SKU.')
33-
@allowed(['Developer', 'Premium', 'StandardV2', 'PremiumV2'])
33+
@allowed(['Developer', 'Premium', 'Standard', 'StandardV2', 'PremiumV2'])
3434
param skuName string = 'StandardV2'
3535

3636
@description('Application Insights name for logger/diagnostic testing.')
@@ -49,7 +49,7 @@ param logAnalyticsName string = 'bvt-${uniqueString(resourceGroup().id)}-tgt-law
4949
// Variables
5050
// ---------------------------------------------------------------------------
5151

52-
var isClassicSku = skuName == 'Developer' || skuName == 'Premium'
52+
var isClassicSku = skuName == 'Developer' || skuName == 'Premium' || skuName == 'Standard'
5353
var apimSkuCapacity = isClassicSku ? 1 : 1
5454

5555
// ---------------------------------------------------------------------------

tests/integration/all-resource-types/modules/LogMasking.psm1

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,43 @@ function Resolve-NativeExecutable {
186186
return [pscustomobject]@{ FilePath = $exePath; Prefix = $prefix }
187187
}
188188

189+
<#
190+
.SYNOPSIS
191+
Resolves the apiops CLI entrypoint from repository build output.
192+
193+
.OUTPUTS
194+
System.Management.Automation.PSCustomObject
195+
#>
196+
function Resolve-ApiopsInvocation {
197+
$moduleDir = Split-Path -Parent $PSCommandPath
198+
$repoRoot = $null
199+
$cursor = $moduleDir
200+
201+
while (-not [string]::IsNullOrWhiteSpace($cursor)) {
202+
if (Test-Path (Join-Path $cursor 'package.json')) {
203+
$repoRoot = $cursor
204+
break
205+
}
206+
207+
$parent = Split-Path -Parent $cursor
208+
if ($parent -eq $cursor) {
209+
break
210+
}
211+
$cursor = $parent
212+
}
213+
214+
if ([string]::IsNullOrWhiteSpace($repoRoot)) {
215+
throw 'Could not locate repository root from LogMasking module path.'
216+
}
217+
218+
$distCliPath = Join-Path $repoRoot 'dist/cli/index.js'
219+
if (-not (Test-Path $distCliPath)) {
220+
throw "apiops CLI entrypoint not found: $distCliPath. Run 'npm run build' from repository root."
221+
}
222+
223+
return [pscustomobject]@{ FilePath = 'node'; Prefix = @($distCliPath) }
224+
}
225+
189226
<#
190227
.SYNOPSIS
191228
Runs a process and streams masked output.
@@ -326,8 +363,9 @@ function Invoke-MaskedApiopsCommand {
326363
[hashtable]$Replacements
327364
)
328365

329-
Invoke-MaskedProcess -FilePath 'npx' `
330-
-Arguments (@('apiops') + $Arguments) `
366+
$apiops = Resolve-ApiopsInvocation
367+
Invoke-MaskedProcess -FilePath $apiops.FilePath `
368+
-Arguments (@($apiops.Prefix) + $Arguments) `
331369
-Replacements $Replacements
332370

333371
return $LASTEXITCODE
@@ -366,6 +404,7 @@ Export-ModuleMember -Function `
366404
Protect-ApimName, `
367405
Protect-LogLine, `
368406
Resolve-NativeExecutable, `
407+
Resolve-ApiopsInvocation, `
369408
Invoke-MaskedProcess, `
370409
Invoke-MaskedApiopsCommand, `
371410
Invoke-MaskedAzCommand

tests/integration/all-resource-types/modules/ScriptRuntime.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ function Set-ScriptLogPreferences {
8080
[string]$LogLevel
8181
)
8282

83-
Set-Variable -Name VerbosePreference -Scope 1 -Value (if ($LogLevel -in @('Verbose', 'Debug')) { 'Continue' } else { 'SilentlyContinue' })
84-
Set-Variable -Name DebugPreference -Scope 1 -Value (if ($LogLevel -eq 'Debug') { 'Continue' } else { 'SilentlyContinue' })
83+
Set-Variable -Name VerbosePreference -Scope 1 -Value $(if ($LogLevel -in @('Verbose', 'Debug')) { 'Continue' } else { 'SilentlyContinue' })
84+
Set-Variable -Name DebugPreference -Scope 1 -Value $(if ($LogLevel -eq 'Debug') { 'Continue' } else { 'SilentlyContinue' })
8585
}
8686

8787
<#

tests/integration/all-resource-types/phases/run-phase1-deploy-source.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ param(
4545

4646
[string]$Location = 'eastus2',
4747

48-
[ValidateSet('Developer', 'Premium', 'StandardV2', 'PremiumV2')]
48+
[ValidateSet('Developer', 'Premium', 'Standard', 'StandardV2', 'PremiumV2')]
4949
[string]$SkuName = 'StandardV2',
5050

5151
[string]$ApimName,

tests/integration/all-resource-types/phases/run-phase1-deploy-target.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ param(
3131

3232
[string]$Location = 'eastus2',
3333

34-
[ValidateSet('Developer', 'Premium', 'StandardV2', 'PremiumV2')]
34+
[ValidateSet('Developer', 'Premium', 'Standard', 'StandardV2', 'PremiumV2')]
3535
[string]$SkuName = 'StandardV2',
3636

3737
[string]$ApimName,

tests/integration/all-resource-types/phases/run-phase1-deploy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ param(
5454
[Parameter(Mandatory)]
5555
[string]$TargetResourceGroup,
5656

57-
[ValidateSet('Developer', 'Premium', 'StandardV2', 'PremiumV2')]
57+
[ValidateSet('Developer', 'Premium', 'Standard', 'StandardV2', 'PremiumV2')]
5858
[string]$SkuName = 'StandardV2',
5959

6060
[string]$Location = 'eastus2',

0 commit comments

Comments
 (0)