Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test pipeline for common-tests #5040

Merged
1 commit merged into from
Jan 9, 2023
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 doc/development/powershell.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Unit tests should be written for all scripts, and should utilize [Pester](https:

- Tests can be located alongside scripts in a directory called `tests`.
- Example pester test suites: [job matrix tests](https://github.com/Azure/azure-sdk-tools/tree/main/eng/common/scripts/job-matrix/tests), [asset sync tests](https://github.com/Azure/azure-sdk-tools/blob/main/tools/asset-sync/assets.Tests.ps1)
- A CI pipeline should be defined to run scripts unit tests at the very least. See [archetype-sdk-tool-pwsh](https://github.com/Azure/azure-sdk-tools/blob/main/eng/pipelines/templates/stages/archetype-sdk-tool-pwsh.yml) for how to do this.
- A CI pipeline should be defined to run scripts unit tests at the very least. See [archetype-sdk-tool-pwsh](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/pipelines/templates/stages/archetype-sdk-tool-pwsh.yml) for how to do this.
- Script code should always be written so as much of the surface area as possible can be run via unit tests. Move code that calls out to external dependencies into modular functions, and simplify context/data structures passed to functions as much as possible to it can be easily mocked.

#### Running Pester Tests
Expand Down
30 changes: 30 additions & 0 deletions eng/common-tests/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
paths:
include:
- eng/common/scripts/*
- eng/common-tests/*

pr:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
paths:
include:
- eng/common/scripts/*
- eng/common-tests/*

extends:
template: /eng/common/pipelines/templates/stages/archetype-sdk-tool-pwsh.yml
parameters:
TargetDirectory: eng/common-tests/
TargetTags: 'UnitTest'

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ variables:
- template: /eng/pipelines/templates/variables/globals.yml

stages:
- stage: 'Test'
- stage: 'eng_script_tests'
jobs:
- job: 'Test'

strategy:
matrix:
Windows:
Expand All @@ -36,7 +35,7 @@ stages:
vmImage: $(Image)

steps:
- template: /eng/pipelines/templates/steps/run-pester-tests.yml
- template: /eng/common/pipelines/templates/steps/run-pester-tests.yml
parameters:
TargetDirectory: ${{ parameters.TargetDirectory }}
CustomTestSteps: ${{ parameters.CustomTestSteps }}
Expand Down
2 changes: 1 addition & 1 deletion tools/asset-sync/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pr:
- tools/asset-sync

extends:
template: /eng/pipelines/templates/stages/archetype-sdk-tool-pwsh.yml
template: /eng/common/pipelines/templates/stages/archetype-sdk-tool-pwsh.yml
parameters:
TargetDirectory: tools/asset-sync/
TargetTags: 'Unit'