Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/UofICDB/Functions/Public/Get-CDBItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
12 changes: 6 additions & 6 deletions test/UofICDB.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'{
Expand Down Expand Up @@ -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
}
}
}
}
}
Expand Down Expand Up @@ -61,7 +61,7 @@ Describe 'Update-CDBSubclassUris'{
New-CDBConnection -Credential $Credential
}

InModuleScope 'UofICDB' {
InModuleScope 'UofICDB' {
It 'Does not throw'{
{Update-CDBSubclassUris} | Should -Not -Throw
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have $TestId rather than the ID value?

}

It 'Accepts pipeline input'{
{Get-CDBItem -Id 1778 | Get-CDBItemPermission} | Should -Not -Throw
{Get-CDBItem -Id 8777 | Get-CDBItemPermission} | Should -Not -Throw
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here about $TestId.

}
}
Loading