Skip to content

Improve Pester Test BackgroundTask and Event stability and provide consistent performance #218

@ddemeyer

Description

@ddemeyer

When there are many BackgroundTasks pending in the virtual queue, it can take 10s of seonds for the Get-IshBackgroundTask tests to complete. The same for the matching logging over Get-IshEvent. The amount of pending BackgroundTasks will go up starting 15.1.3, 15.2.1 and 15.3.0 as the SYNCHRONIZEMETRICS and CLEANUPMETRICS get postponed execution to avoid race conditions on temporary created data. Temporary data is automation like report/test publishing for customers, but also all the ISHRemote Pester tests generate temporary data which has no meaning to the reuse metrics offered in Tridion Docs

  • GetIshBackgroundTask.Tests.ps1 - Several tests retrieve all BackgroundTask entries, can we reduce that by iteratively asking for enough test data over parameter -ModifiedSince
  • GetIshBackgroundTask.Tests.ps1 - Make test 'IshBackgroundTask Single' more resilient as in some cases it reports Expected '94185', but got @('94185', '94185', '94185').
  • GetIshEvent.Tests.ps1 - Several tests retrieve many months of Event entries, can we reduce that by iteratively asking for enough test data over parameter -ModifiedSince
  • GetIshMetadataField.Tests.ps1 should reuse the above iteratively asking for enough test data rewrites
  • Generate PS7 vs PS5.1 and OWcf@15.2.0 (NET48) vs OWcf@15.3.0 (NET8) comparative tests on full stack same hardware, put the fastest run of these 4 rows in \Doc\ReleaseNotes-ISHRemote-8.2.md
Loading ISHRemote.PesterSetup.ps1 on PSVersion[7.5.3] over BeforeAll-block for MyCommand[Get-IshBackgroundTask]...
Running ISHRemote.PesterSetup.ps1 Import Module folder[d:\github\ishremote\source\ishremote\trisoft.ishremote\bin\debug\ISHRemote] ...
Running ISHRemote.PesterSetup.ps1 Global Test Data and Variables initialization on 2025-10-17T09-14-10+02
Running ISHRemote.PesterSetup.ps1 Global Test Data and Variables for debug initialization
Running ISHRemote.PesterSetup.ps1 Detect version over webServicesConnectionConfigurationUrl[https://leudevddemeye01.global.sdl.corp/ISHWSDITA/connectionconfiguration.xml] webServicesConnectionConfigurationUrl.Length[77]
Running Get-IshBackgroundTask Test Data and Variables initialization
Describing Get-IshBackgroundTask
 Context Get-IshBackgroundTask
   [+] GetType().Name 3ms (0ms|2ms)
   [+] ishObject.IshField 1ms (1ms|0ms)
   [+] ishObject.IshRef 0ms (0ms|0ms)
   [+] ishBackgroundTask.TaskRef 0ms (0ms|0ms)
   [+] ishBackgroundTask ConvertTo-Json 14ms (1ms|14ms)
   [+] Parameter IshSession/ModifiedSince/UserFilter invalid 1ms (1ms|0ms)
   [+] Parameter RequestedMetadata/MetadataFile invalid 2ms (1ms|0ms)
   [+] Parameter IshSession/UserFilter/MetadataFilter are optional 28.7s (28.7s|0ms)
   [+] Option IshSession.DefaultRequestedMetadata 69.07s (69.07s|0ms)
   [+] Parameter ModifiedSince is now 82ms (82ms|0ms)
   [+] Parameter RequestedMetadata only all of Task level 32.89s (32.89s|0ms)
   [+] Parameter RequestedMetadata only all of History level 59.59s (59.59s|0ms)
   [+] Parameter RequestedMetadata PipelineObjectPreference=PSObjectNoteProperty 31.55s (31.55s|0ms)
   [+] Parameter RequestedMetadata PipelineObjectPreference=Off 25.49s (25.49s|0ms)
   [+] Parameter MetadataFilter Filter to exactly one 30.79s (30.79s|0ms)
   [+] Parameter IshBackgroundTask invalid 1ms (1ms|0ms)
   [-] Parameter IshBackgroundTask Single 27.81s (27.81s|0ms)
    Expected '94185', but got @('94185', '94185', '94185').
    at $ishBackgroundTaskArray.IshRef | Should -Be $taskId, D:\GITHUB\ISHRemote\Source\ISHRemote\Trisoft.ISHRemote\Cmdlets\BackgroundTask\GetIshBackgroundTask.Tests.ps1:206
    at <ScriptBlock>, D:\GITHUB\ISHRemote\Source\ISHRemote\Trisoft.ISHRemote\Cmdlets\BackgroundTask\GetIshBackgroundTask.Tests.ps1:206
   [+] Pipeline IshBackgroundTask Single 25.36s (25.36s|0ms)
Running Get-IshBackgroundTask Test Data and Variables cleanup
Tests completed in 382.4s
Tests Passed: 17, Failed: 1, Skipped: 0, Inconclusive: 0, NotRun: 0

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions