[Bug]: Install-Lab's built-in Pester validation reports false "deployment failed" when the lab has no Dynamics role (AutomatedLabTest tests crash at discovery under Pester 6)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- powershell
- Área
- testing-qa
Línea de trabajo
Comienza con Invoke-LabPester en AutomatedLabTest y los archivos tests/Dynamics*.tests.ps1 incluidos; reproduce el problema con Pester 6 en un laboratorio sin un rol de Dynamics. Traza cómo se seleccionan los archivos de prueba y compáralo con RootDC.tests.ps1. Se considera completado cuando las pruebas irrelevantes de Dynamics ya no provocan un fallo de validación en una implementación no relacionada con Dynamics que se haya realizado correctamente, y existe cobertura de regresión.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Install-Lab (when called with no role-scoping switches, so $performAll is true) runs a
built-in post-deployment validation pass via Invoke-LabPester from the AutomatedLabTest
module. That function runs EVERY *.tests.ps1 file bundled in AutomatedLabTest's own tests/
folder unconditionally -- there is no filtering by which roles the lab actually defines.
This includes AutomatedLabTest's Dynamics*.tests.ps1 files (DynamicsAdmin, DynamicsBackend,
DynamicsFrontend, DynamicsFull), even though my lab defines no Dynamics role at all. Those
test files' It blocks iterate over what ends up being an empty array (presumably meant to be
populated only when a Dynamics role is present). Pester 6.0.0 changed its default behavior so
that an empty foreach inside an It/Describe block throws
"System.ArgumentException: Value can not be null or empty array" during Pester's own
DISCOVERY phase, unless -AllowNullOrEmptyForEach is passed or
Run.FailOnNullOrEmptyForEach = $false is configured. AutomatedLabTest 5.61.0's bundled test
files were apparently written against an earlier Pester default and are incompatible with
Pester 6 as shipped.
Net effect: Install-Lab reports "Lab deployment seems to have failed" on every single run,
even when the actual deployment succeeded completely. I confirmed this against a live 7-VM
Azure build: the ARM deployment, all VM provisioning and domain joins succeeded (checked
independently via az resource list / az vm list and RDP/WinRM reachability), and the one
test file that actually matches my topology (RootDC.tests.ps1) passed 5 of 5 assertions. Only
the four Dynamics test containers errored, and only at discovery, before any assertion in them
could even run.
Workaround: pass -NoValidation to Install-Lab and verify the deployment through the lab's own
follow-on configuration scripts instead.
Only Pester 6.0.0 was available in my environment when this happened (alongside a legacy
Pester 3.4.0 -- no Pester 5.x was installed), so I have not been able to check whether this
also affects a Pester 5.x install, but the underlying issue (Dynamics test files unconditionally
included even with no Dynamics role in the lab) exists regardless of the Pester version.
Steps to reproduce the issue
# Any Azure (or Hyper-V) lab with a RootDC and no Dynamics role, e.g.:
New-LabDefinition -Name 'ReproLab' -DefaultVirtualizationEngine Azure
Add-LabAzureSubscription -SubscriptionId <subId> -DefaultLocationName 'swedencentral' `
-DefaultResourceGroupName 'rg-repro'
Add-LabVirtualNetworkDefinition -Name 'ReproNet' -AddressSpace '10.60.0.0/24'
Set-LabInstallationCredential -Username 'Install' -Password 'SomeP@ssw0rd!'
Add-LabDomainDefinition -Name 'repro.local' -AdminUser 'Install' -AdminPassword 'SomeP@ssw0rd!'
Add-LabMachineDefinition -Name 'DC01' -Roles RootDC `
-OperatingSystem 'Windows Server 2022 Datacenter' `
-DomainName 'repro.local' -Network 'ReproNet' -AzureRoleSize 'Standard_D2as_v5'
Install-Lab
# --> deployment itself succeeds (VM up, domain promoted), but Install-Lab still reports
# "Lab deployment seems to have failed" because of the bundled Dynamics*.tests.ps1 files
# crashing at Pester discovery.
# Isolating just the validation step against an already-built lab reproduces the same crash:
Import-Module AutomatedLabTest -RequiredVersion 5.61.0
Invoke-LabPester -LabName 'ReproLab'
# --> System.ArgumentException: Value can not be null or empty array, from one/more of
# Dynamics*.tests.ps1, thrown during Pester discovery, before any real assertion runs.
# Confirming the Pester-side trigger directly:
Import-Module Pester -RequiredVersion 6.0.0
$PesterPreference = [PesterConfiguration]::Default
Invoke-Pester -Path (Join-Path (Get-Module AutomatedLabTest -ListAvailable).ModuleBase 'tests\DynamicsAdmin.tests.ps1') -PassThru
# --> same ArgumentException at discovery
PowerShell Version
PowerShell Version:
Name Value
---- -----
PSVersion 5.1.26100.8972
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.8972
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
AutomatedLab Version
AutomatedLab Version:
Name Version
---- -------
AutomatedLab 5.61.0
AutomatedLab.Common 2.3.37
AutomatedLab.Recipe 5.61.0
AutomatedLab.Ships 5.61.0
AutomatedLabCore 5.61.0
AutomatedLabDefinition 5.61.0
AutomatedLabNotifications 5.61.0
AutomatedLabTest 5.61.0
AutomatedLabUnattended 5.61.0
AutomatedLabWorker 5.61.0
- Lenguaje dominante
- PowerShell
- Estrellas
- 2.2k
- Forks
- 383
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AutomatedLab/AutomatedLab
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
AutomatedLab/AutomatedLab#1855 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
AutomatedLab/AutomatedLab#1854 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
AutomatedLab/AutomatedLab#1857 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
AutomatedLab/AutomatedLab#1856 ·
-
[Bug]: Invoke-LabCommand cannot reach Linux machines - omi-psrp-server no longer installs on el8+ Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
AutomatedLab/AutomatedLab#1853 ·
Todos los issues de AutomatedLab/AutomatedLab
Issues similares
-
refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
bug follow-up-work-in-progress from-review-extraction llm-providers python severity:should-fix
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
type/automation type/tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
bug core
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
[Duplicate Code] Share the Cloud Hypervisor network-plan fixture between launch and config tests Abiertocode-quality refactoring
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
github/gh-aw-firewall#8974 ·