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

Use pre steps to determine whether to record live tests #17063

Merged
merged 3 commits into from
Nov 20, 2020
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
12 changes: 10 additions & 2 deletions eng/pipelines/templates/jobs/archetype-sdk-tests-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
maxParallel: ${{ parameters.MaxParallel }}
matrix: ${{ parameters.Platforms }}

condition: and(succeededOrFailed(), eq(eq(variables['Record'], 'true'), eq('$(TestMode)', 'Record')))
variables:
- template: ../variables/globals.yml
# ServiceDirectory references must get passed down by the caller as variable references
Expand All @@ -52,6 +51,8 @@ jobs:
value: ''
- name: ArmTemplateParameters
value: '@{}'
- name: TestMode
value: 'None'

timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}

Expand All @@ -77,6 +78,13 @@ jobs:
SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}
ArmTemplateParameters: $(ArmTemplateParameters)

- pwsh: |
if ($env:SupportsRecording -and $env:Record) {
Write-Host "Enabling Record mode"
Write-Host "##vso[task.setvariable variable=TestMode]Record"
}
displayName: Set Test Mode

- pwsh: >
dotnet test eng/service.proj
--framework $(TestTargetFramework)
Expand All @@ -93,7 +101,7 @@ jobs:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
AZURE_TEST_MODE: "${{ coalesce(variables['TestMode'], 'None') }}"
AZURE_TEST_MODE: $(TestMode)
${{ each var in parameters.EnvVars }}:
${{ var.key }}: ${{ var.value }}

Expand Down
10 changes: 3 additions & 7 deletions eng/pipelines/templates/stages/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ parameters:
Windows_NetCore:
OSVmImage: "windows-2019"
TestTargetFramework: netcoreapp2.1
SupportsRecording: true
Windows_NetCore_ProjectRefAzureClients:
OSVmImage: "windows-2019"
TestTargetFramework: netcoreapp2.1
Expand All @@ -73,11 +74,6 @@ parameters:
OSVmImage: "macOS-10.15"
TestTargetFramework: netcoreapp2.1
SupportedClouds: 'Public'
Windows_NetCore_Record:
OSVmImage: "windows-2019"
TestMode: Record
TestTargetFramework: netcoreapp2.1
SupportedClouds: 'Public'
- name: PlatformPreSteps
type: object
default:
Expand All @@ -86,7 +82,7 @@ parameters:
type: object
default:
- task: CopyFiles@2
condition: and(succeededOrFailed(), eq(variables['Agent.JobName'], 'Windows_NetCore_Record'))
condition: and(succeededOrFailed(), eq(variables.TestMode, 'Record'))
displayName: "Copy Test Recordings"
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
Expand All @@ -95,7 +91,7 @@ parameters:
contents: 'sdk/$(ServiceDirectory)/**/SessionRecords/**/*.json'
targetFolder: '$(Build.ArtifactStagingDirectory)/SessionRecords'
- task: PublishBuildArtifacts@1
condition: and(succeededOrFailed(), eq(variables['Agent.JobName'], 'Windows_NetCore_Record'))
condition: and(succeededOrFailed(), eq(variables.TestMode, 'Record'))
displayName: "Publish Test Recordings"
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)/SessionRecords'
Expand Down