Skip to content

[Utilities] Improve API version tests through the AzureAPICrawler PowerShell module #2344

Merged
AlexanderSehr merged 42 commits intomainfrom
users/alsehr/leverageAPICrawler
Dec 19, 2022
Merged

[Utilities] Improve API version tests through the AzureAPICrawler PowerShell module #2344
AlexanderSehr merged 42 commits intomainfrom
users/alsehr/leverageAPICrawler

Conversation

@AlexanderSehr
Copy link
Copy Markdown
Contributor

@AlexanderSehr AlexanderSehr commented Nov 20, 2022

Description

  • Added pipelines to generate an apiSpecsList.json file that contains a snapshot of all available API versions. The pipelines have a trigger to run on a schedule
  • Generated & added a current snapshot
  • Updated the API Pester tests to leverage file instead of Get-AzResourceProvider -ListAvailable function
  • Updated format of settings.yml and added a flag to control whether the API test should fail when preview versions are used

Further updated the verbosity:

  • The API tests return the following output if using a soon to be expired API version (i.e., only one other API version that would be expired first):

    Describing API version tests [All apiVersions in the template should be 'recent']
      [+] In [Microsoft.Resources/resourceGroups] used resource type [locks] should use one of the recent API version(s). Currently using [2020-05-01] 110ms (50ms|60ms)
      [+] In [Microsoft.Resources/resourceGroups] used resource type [roleassignments] should use one of the recent API version(s). Currently using [2022-04-01] 27ms (25ms|3ms)
    WARNING: The used API version [2020-08-01] for Resource Type [Microsoft.Resources/resourceGroups] will soon expire. Please consider updating it. Consider using one of the newer API versions [2022-09-01, 2021-04-01, 2021-01-01, 2020-10-01]
      [+] In [Microsoft.Resources/resourceGroups] used resource type [resourceGroups] should use one of the recent API version(s). Currently using [2020-08-01] 20ms (16ms|4ms)
  • The API tests return the following result if using an expired API version

    Describing API version tests [All apiVersions in the template should be 'recent']
      [+] In [Microsoft.Resources/resourceGroups] used resource type [locks] should use one of the recent API version(s). Currently using [2020-05-01] 142ms (127ms|15ms)
      [+] In [Microsoft.Resources/resourceGroups] used resource type [roleassignments] should use one of the recent API version(s). Currently using [2022-04-01] 33ms (26ms|6ms)
      [-] In [Microsoft.Resources/resourceGroups] used resource type [resourceGroups] should use one of the recent API version(s). Currently using [2019-05-01] 140ms (130ms|9ms)
       Expected '2019-05-01' to be found in collection @('2022-09-01', '2021-04-01', '2021-01-01', '2020-10-01', '2020-08-01'), but it was not found.
       at $approvedApiVersions | Should -Contain $TargetApi, C:\dev\ip\Azure-ResourceModules\ResourceModules\utilities\pipelines\staticValidation\module.tests.ps1:1352
       at <ScriptBlock>, C:\dev\ip\Azure-ResourceModules\ResourceModules\utilities\pipelines\staticValidation\module.tests.ps1:1352

NOTE: This Pull Request introduces a dependency on the AzureAPICrawler PowerShell module.

Pipeline references

For module/pipeline changes, please create and attach the status badge of your successful run.

Pipeline Notes
Build Status ADO Crawler Execution
Build Status ADO API Test
.Platform: Update API Specs file GH Crawler Execution
AnalysisServices: Servers GH API Test

Type of Change

Please delete options that are not relevant.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Update to documentation

@AlexanderSehr AlexanderSehr requested a review from a team as a code owner November 20, 2022 16:20
@AlexanderSehr AlexanderSehr self-assigned this Nov 20, 2022
@AlexanderSehr AlexanderSehr added enhancement New feature or request [cat] pipelines category: pipelines [cat] testing category: testing labels Nov 20, 2022
@AlexanderSehr AlexanderSehr marked this pull request as draft November 20, 2022 16:22
@AlexanderSehr AlexanderSehr changed the title [Utilities] Improve API version tests through the 'AzureAPICrawler' PowerShell module [Utilities] Improve API version tests through the AzureAPICrawler PowerShell module Nov 20, 2022
@AlexanderSehr AlexanderSehr marked this pull request as ready for review November 22, 2022 12:00
@AlexanderSehr AlexanderSehr enabled auto-merge (squash) November 22, 2022 12:00
@AlexanderSehr AlexanderSehr marked this pull request as draft November 22, 2022 17:44
@AlexanderSehr
Copy link
Copy Markdown
Contributor Author

Converting to draft until after Release 0.8.0 was created.

@AlexanderSehr AlexanderSehr added the blocked if an issue is blocked label Nov 22, 2022
@AlexanderSehr AlexanderSehr marked this pull request as ready for review December 1, 2022 06:24
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 12, 2022

Test Results

56 tests   55 ✔️  21s ⏱️
  1 suites    1 💤
  1 files      0

Results for commit e57e58f.

♻️ This comment has been updated with latest results.

@AlexanderSehr AlexanderSehr requested a review from eriqua December 13, 2022 15:49
AlexanderSehr and others added 6 commits December 18, 2022 23:49
Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com>
Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com>
Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com>
@AlexanderSehr AlexanderSehr requested a review from eriqua December 19, 2022 12:26
Copy link
Copy Markdown
Contributor

@eriqua eriqua left a comment

Choose a reason for hiding this comment

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

🆗

@AlexanderSehr AlexanderSehr merged commit 117e6f9 into main Dec 19, 2022
@AlexanderSehr AlexanderSehr deleted the users/alsehr/leverageAPICrawler branch December 19, 2022 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[cat] pipelines category: pipelines [cat] testing category: testing enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Update the Get-AzResourceProvider -ListAvailable in our Pester tests with a custom API version solution

2 participants