-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Some tests do not perform proper Module cleanup #11058
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Quality-Testissues in a test or in test infrastructureissues in a test or in test infrastructure
Description
In CI we run several different test suites in the same PS runspace.
Some tests do Not cleanup after themselves, leaving loaded modules they were working with.
Sometimes this produces unexpected results and breaks subsequent tests.
Steps to reproduce
- add
get-modulein the beginning of each test file - run tests, notice any non-standard modules
- find tests, where those modules are used, and update them with a proper cleanup
Actual behavior
here is example output listing modules that are loaded in the beginning of an unrelated test file
VERBOSE: Listing all loaded modules:
certificateCommon -
CimCmdlets
HelpersCommon
HelpersRemoting
HelpersSecurity
ImportTrustedManifestWithCallOperator_System32
ImportTrustedManifestWithCmdletExport_System32
ImportTrustedManifestWithDotSourceModAndFnExport_System32
ImportTrustedManifestWithExportFn_System32
ImportTrustedManifestWithNestedModsAndFnExport_System32
ImportTrustedManifestWithNestedModsAndNoExtNoFnExport_System32
ImportTrustedManifestWithNestedModsAndNoFnExport_System32
ImportTrustedManifestWithNoFnExport_System32
ImportTrustedManifestWithTwoMods_System32
ImportTrustedManifestWithWildcardFnExport1_System32
ImportTrustedManifestWithWildcardModFnExport_System32
ImportTrustedManifestWithWildcardNameFnExport_System32
ImportTrustedModuleForTest_System32
ImportTrustedModuleTest_System32
ImportTrustedModuleWithFnExport_System32
ImportTrustedModuleWithNoFnExport_System32
ImportTrustedModuleWithWildcardFnExport_System32
ImportUntrustedManifestWithFnExport
ImportUnTrustedManifestWithFnExport_System32
ImportUntrustedManifestWithNoFnExport
ImportUnTrustedModuleWithFnExport
ImportUnTrustedModuleWithNoFnExport
Microsoft.PowerShell.Archive
Microsoft.PowerShell.Management
Microsoft.PowerShell.Security
Microsoft.PowerShell.Utility
Microsoft.WSMan.Management
ModuleDotSourceNestedExport_System32
ModuleDotSourceNoExportE_System32
ModuleDotSourceNoWildcard_System32
ModuleDotSourceWildcard_System32
ModuleDotSourceWildCardM_System32
ModuleWithUsing_System32
PackageManagement
Pester
pkiTrue
PSDiagnostics
PSSysLog
TestImport
ThreadJob
TrustedImportModule_System32
TrustedParentModule_System32
UntrustedModuleScriptBlockTest
UntrustedScriptFoo
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Quality-Testissues in a test or in test infrastructureissues in a test or in test infrastructure