diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index 138cd4b..1ba1c33 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 31e7341..5b6fe65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Removed +## [1.2.1] 2026-06-01 +### Changed +- Get-CDBItem -Returnall parameter changed to use limit of 200 to reduce errors from service +- Update CDBItem ID used for pester tests and update Ubuntu runner version to latest + ## [1.2.0] 2023-10-03 ### Changed - Changed endpoint in settings.json from cdb.cites.illinois.edu to cdb.techservices.illinois.edu as the old endpoint will be going away diff --git a/src/UofICDB/Functions/Public/Get-CDBItem.ps1 b/src/UofICDB/Functions/Public/Get-CDBItem.ps1 index 86dbc26..791b6dd 100644 --- a/src/UofICDB/Functions/Public/Get-CDBItem.ps1 +++ b/src/UofICDB/Functions/Public/Get-CDBItem.ps1 @@ -106,14 +106,14 @@ function Get-CDBItem { Write-Warning -Message 'Ignoring provided limit since ReturnAll was also specified.' } - #CDB has a hard cap of 1000 items returned in a single call. So to get all results we have to first get the total count from the meta data and then iterate through batches of 1000 results using the offset parameter. + #To get all results we have to first get the total count from the meta data and then iterate through batches of 200 results using the offset parameter. [int]$TotalObjects = (Invoke-CDBRestCall -RelativeURI $Script:SubClassURIs[$SubClass].list_endpoint -Limit 1).meta.total_count Write-Verbose -Message "$($TotalObjects) total objects of subclass $($SubClass) available." [int]$Offset = 0 While($TotalObjects -gt 0){ - $Return += (Invoke-CDBRestCall -RelativeURI $Script:SubClassURIs[$SubClass].list_endpoint -Filter $Filter -Limit 1000 -Offset $Offset).Objects - $Offset += 1000 - $TotalObjects -= 1000 + $Return += (Invoke-CDBRestCall -RelativeURI $Script:SubClassURIs[$SubClass].list_endpoint -Filter $Filter -Limit 200 -Offset $Offset).Objects + $Offset += 200 + $TotalObjects -= 200 } } else{ diff --git a/test/UofICDB.Tests.ps1 b/test/UofICDB.Tests.ps1 index d2373c9..a72f960 100644 --- a/test/UofICDB.Tests.ps1 +++ b/test/UofICDB.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { $secStringPassword = ConvertTo-SecureString -String $ENV:TestAPIPw -AsPlainText $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ($ENV:TestAPIUser, $secStringPassword) - [int]$TestId = 1770 #This will likely break at some point and need updating. We have tests based around this object existing in CDB. + [int]$TestId = 8777 #This will likely break at some point and need updating. We have tests based around this object existing in CDB. } Describe 'New-CDBConnection'{ @@ -33,7 +33,7 @@ Describe 'New-CDBConnection'{ It 'Encrypts the saved password'{ { (Get-Content -Path $Script:SavedCredsDir | ConvertFrom-Json).password | ConvertTo-SecureString } | Should -Not -Throw - } + } } } } @@ -61,7 +61,7 @@ Describe 'Update-CDBSubclassUris'{ New-CDBConnection -Credential $Credential } - InModuleScope 'UofICDB' { + InModuleScope 'UofICDB' { It 'Does not throw'{ {Update-CDBSubclassUris} | Should -Not -Throw } @@ -124,7 +124,7 @@ Describe 'Get-CDBItem'{ BeforeAll { New-CDBConnection -Credential $Credential } - + It 'Handles the redirect off an Id'{ $null -eq (Get-CDBItem -id $TestId).subclass | Should -Be $True $null -ne (Get-CDBItem -id $TestId).name | Should -Be $True @@ -175,10 +175,10 @@ Describe 'Get-CDBItem'{ Describe 'Get-CDBItemPermission'{ It 'Returns permissions for a given item'{ - (Get-CDBItemPermission -id 1778).permissions | Should -Not -BeNullOrEmpty + (Get-CDBItemPermission -id 8777).permissions | Should -Not -BeNullOrEmpty } It 'Accepts pipeline input'{ - {Get-CDBItem -Id 1778 | Get-CDBItemPermission} | Should -Not -Throw + {Get-CDBItem -Id 8777 | Get-CDBItemPermission} | Should -Not -Throw } }