Skip to content

Latest commit

 

History

History
146 lines (106 loc) · 3.67 KB

Invoke-AvmTest.md

File metadata and controls

146 lines (106 loc) · 3.67 KB

Invoke-AvmTest

Synopsis

Build Bicep sources or validate Terraform examples under $Path.

Description

Routes to the engine matching the module's ecosystem:

  • bicep -> Invoke-AvmBicepTest ('bicep build --stdout' per file)
  • terraform -> Invoke-AvmTerraformTest ('terraform validate -json' per example with auto-init)

The ecosystem is determined by Get-AvmModuleContext, which honours the .avm/context.psd1 override file and the -Ecosystem filter.

This verb covers the cheap build-validation pass and runs no tests: it reports FilesProcessed (Bicep sources or direct Terraform example configuration files) and carries no run counts. The real test tiers are the separate 'avm test unit', 'avm test integration' and 'avm test e2e' verbs, which report test run counts (Bicep Pester or Terraform tests). In the gauntlets this verb is the step named 'validate' for that reason.

Terraform includes .e2eignore examples and warns when the root module or an immediate modules/ configuration is not reached by a local example. Coverage gaps do not fail validation. No examples is skipped.

Routed by the dispatcher: 'avm test'.

CLI commands

  • avm test

Syntax

Invoke-AvmTest [[-Path] <string>] [-Ecosystem <string>] [-AllowPathFallback] [-NoInit] [-UseExistingInit] [-SkipModuleVersionCheck] [<CommonParameters>]

Parameters

-AllowPathFallback

When set, accept a PATH-resolved tool binary that self-reports the lock-pinned version.

Property Value
Type Switch
Required false
Position named
Default value False
Accept pipeline input false
Accept wildcard characters false

-Ecosystem

Force the ecosystem selector. Defaults to 'auto'.

Property Value
Type String
Required false
Position named
Default value auto
Accept pipeline input false
Accept wildcard characters false

-NoInit

Terraform-only: skip each example's 'terraform init -backend=false -upgrade' step and use its existing initialization. Module coverage is not assessed with this switch and reports a warning. Ignored for Bicep.

Property Value
Type Switch
Required false
Position named
Default value False
Accept pipeline input false
Accept wildcard characters false

-Path

Working directory whose enclosing module to test. Defaults to the current location.

Property Value
Type String
Required false
Position 1
Default value $PWD.Path
Accept pipeline input false
Accept wildcard characters false

-SkipModuleVersionCheck

Skip the PowerShell Gallery check that otherwise stops the command when a newer Avm.Authoring version is available. Writes a warning once.

Property Value
Type Switch
Required false
Position named
Default value False
Accept pipeline input false
Accept wildcard characters false

-UseExistingInit

Terraform-only: reuse initialization prepared by a composite command and assess module coverage from each example's existing '.terraform/modules/modules.json'.

Property Value
Type Switch
Required false
Position named
Default value False
Accept pipeline input false
Accept wildcard characters false

Examples

EXAMPLE 1

avm test

EXAMPLE 2

Invoke-AvmTest -Path C:\repos\my-module -Ecosystem bicep

Outputs

  • pscustomobject from the engine: Engine, Tool, ToolPath, ToolSource, Status, FilesProcessed, Issues.