-
Notifications
You must be signed in to change notification settings - Fork 157
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
bug/fixes#326 #335
bug/fixes#326 #335
Changes from 6 commits
c60f354
2465e18
943204a
509ccda
381a015
c16e0bf
db3ccab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,64 @@ Describe 'VSTeam Integration Tests' -Tag 'integration' { | |
} | ||
} | ||
|
||
Context 'ReleaseDefinition full exercise' { | ||
BeforeAll { | ||
|
||
if ($acct -like "http://*") { | ||
$defaultQueue = Get-VSTeamQueue -ProjectName $newProjectName | Where-Object { $_.poolName -eq "Default" } | ||
} | ||
else { | ||
$defaultQueue = Get-VSTeamQueue -ProjectName $newProjectName | Where-Object { $_.poolName -eq "Hosted" } | ||
} | ||
|
||
$srcReleaseDef = Get-Content "$PSScriptRoot\sampleFiles\010_releasedef_1.json" -Raw | ConvertFrom-Json | ||
$srcReleaseDef.name = $newProjectName + "-CD1" | ||
$srcReleaseDef.environments[0].deployPhases[0].deploymentInput.queueId = $defaultQueue.Id | ||
$tmpReleaseDef1 = (New-TemporaryFile).FullName | ||
$srcReleaseDef | ConvertTo-Json -Depth 10 | Set-Content -Path $tmpReleaseDef1 | ||
|
||
Invoke-VSTeamRequest -ProjectName $newProjectName -Method Post -SubDomain vsrm -Area Release -Resource definitions -Version "5.1" -InFile $tmpReleaseDef1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard coding the version will cause these tests to fail on TFS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit confused of what you are trying to do here. Why are you using Invoke-VSTeamRequest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the version is corrected it appears to work on TFS2018 and above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think have the tests fixed now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for correcting! I don't know anymore why I used the wrong command for testing release definitions. Doesn't make sense to me anymore. Maybe a brain hickup... |
||
|
||
$srcReleaseDef = Get-Content "$PSScriptRoot\sampleFiles\010_releasedef_2.json" -Raw | ConvertFrom-Json | ||
$srcReleaseDef.name = $newProjectName + "-CD2" | ||
$srcReleaseDef.environments[0].deployPhases[0].deploymentInput.queueId = $defaultQueue.Id | ||
$tmpReleaseDef2 = (New-TemporaryFile).FullName | ||
$srcReleaseDef | ConvertTo-Json -Depth 10 | Set-Content -Path $tmpReleaseDef2 | ||
|
||
Invoke-VSTeamRequest -ProjectName $newProjectName -Method Post -SubDomain vsrm -Area Release -Resource definitions -Version "5.1" -InFile $tmpReleaseDef2 | ||
} | ||
|
||
It 'Should have 2 release definition' { | ||
$buildDefs = Get-VSTeamReleaseDefinition -ProjectName $newProjectName | ||
$buildDefs.Count | Should -Be 2 | ||
} | ||
|
||
# Only run for VSTS | ||
if ($env:API_VERSION -eq 'VSTS') { | ||
It 'Get-VSTeamBuildDefinition by Id should return intended attribute values for 1st release definition' { | ||
$releaseDefId = (Get-VSTeamReleaseDefinition -ProjectName $newProjectName | Where-Object { $_.Name -eq $($newProjectName + "-CD1") }).Id | ||
$releaseDefId | Should -Not -Be $null | ||
$releaseDef = Get-VSTeamReleaseDefinition -ProjectName $newProjectName -Id $releaseDefId | ||
$releaseDef.Name | Should -Be $($newProjectName + "-CD1") | ||
$releaseDef.environments[0].deployPhases.Count | Should -Be 1 | ||
$releaseDef.environments[0].deployPhases[0].Name | Should -Be "Phase 1" | ||
$releaseDef.environments[0].deployPhases[0].workflowTasks.Count | Should -Be 1 | ||
$releaseDef.environments[0].deployPhases[0].workflowTasks[0].Name | Should -Be "PowerShell Script" | ||
$releaseDef.environments[0].deployPhases[0].workflowTasks[0].inputs.targetType | Should -Be "inline" | ||
} | ||
|
||
It 'Get-VSTeamBuildDefinition by Id should return 2 phases for 2nd build definition' { | ||
$releaseDefId = (Get-VSTeamReleaseDefinition -ProjectName $newProjectName | Where-Object { $_.Name -eq $($newProjectName + "-CD2") }).Id | ||
((Get-VSTeamReleaseDefinition -ProjectName $newProjectName -Id $releaseDefId).environments[0].deployPhases).Count | Should -Be 2 | ||
} | ||
} | ||
|
||
It 'Remove-VSTeamBuildDefinition should delete build definition' { | ||
Get-VSTeamReleaseDefinition -ProjectName $newProjectName | Remove-VSTeamReleaseDefinition -ProjectName $newProjectName -Force | ||
Get-VSTeamReleaseDefinition -ProjectName $newProjectName | Should -Be $null | ||
} | ||
} | ||
|
||
Context 'Pool full exercise' { | ||
It 'Get-VSTeamPool Should return agent pools' { | ||
$actual = Get-VSTeamPool | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ | ||
"source": "undefined", | ||
"revision": 1, | ||
"description": null, | ||
"createdBy": null, | ||
"createdOn": "0001-01-01T00:00:00", | ||
"modifiedBy": null, | ||
"modifiedOn": "0001-01-01T00:00:00", | ||
"isDeleted": false, | ||
"variables": {}, | ||
"variableGroups": [], | ||
"environments": [ | ||
{ | ||
"id": 0, | ||
"name": "Environment 1", | ||
"variables": {}, | ||
"variableGroups": [], | ||
"preDeployApprovals": { | ||
"approvals": [ | ||
{ | ||
"rank": 1, | ||
"isAutomated": true, | ||
"isNotificationOn": false, | ||
"id": 0 | ||
} | ||
] | ||
}, | ||
"postDeployApprovals": { | ||
"approvals": [ | ||
{ | ||
"rank": 1, | ||
"isAutomated": true, | ||
"isNotificationOn": false, | ||
"id": 0 | ||
} | ||
] | ||
}, | ||
"deployPhases": [ | ||
{ | ||
"deploymentInput": { | ||
"parallelExecution": { | ||
"parallelExecutionType": 0 | ||
}, | ||
"skipArtifactsDownload": false, | ||
"artifactsDownloadInput": { | ||
"downloadInputs": [] | ||
}, | ||
"queueId": 25, | ||
"demands": [], | ||
"enableAccessToken": false, | ||
"timeoutInMinutes": 0, | ||
"jobCancelTimeoutInMinutes": 1, | ||
"condition": "succeeded()", | ||
"overrideInputs": {} | ||
}, | ||
"rank": 1, | ||
"phaseType": 1, | ||
"name": "Phase 1", | ||
"refName": null, | ||
"workflowTasks": [ | ||
{ | ||
"environment": {}, | ||
"taskId": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", | ||
"version": "2.*", | ||
"name": "PowerShell Script", | ||
"refName": "", | ||
"enabled": true, | ||
"alwaysRun": false, | ||
"continueOnError": false, | ||
"timeoutInMinutes": 0, | ||
"definitionType": "task", | ||
"overrideInputs": {}, | ||
"condition": "succeeded()", | ||
"inputs": { | ||
"targetType": "inline", | ||
"filePath": "", | ||
"arguments": "", | ||
"script": "Write-Host \"Hello World\"\n", | ||
"errorActionPreference": "stop", | ||
"failOnStderr": "false", | ||
"ignoreLASTEXITCODE": "false", | ||
"pwsh": "false", | ||
"workingDirectory": "" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"environmentOptions": { | ||
"emailNotificationType": "OnlyOnFailure", | ||
"emailRecipients": "release.environment.owner;release.creator", | ||
"skipArtifactsDownload": false, | ||
"timeoutInMinutes": 0, | ||
"enableAccessToken": false, | ||
"publishDeploymentStatus": true, | ||
"badgeEnabled": false, | ||
"autoLinkWorkItems": false, | ||
"pullRequestDeploymentEnabled": false | ||
}, | ||
"demands": [], | ||
"conditions": [], | ||
"executionPolicy": { | ||
"concurrencyCount": 1, | ||
"queueDepthCount": 0 | ||
}, | ||
"schedules": [], | ||
"retentionPolicy": { | ||
"daysToKeep": 30, | ||
"releasesToKeep": 3, | ||
"retainBuild": true | ||
}, | ||
"processParameters": {}, | ||
"properties": {}, | ||
"preDeploymentGates": { | ||
"id": 0, | ||
"gatesOptions": null, | ||
"gates": [] | ||
}, | ||
"postDeploymentGates": { | ||
"id": 0, | ||
"gatesOptions": null, | ||
"gates": [] | ||
}, | ||
"environmentTriggers": [] | ||
} | ||
], | ||
"artifacts": [], | ||
"triggers": [], | ||
"releaseNameFormat": null, | ||
"tags": [], | ||
"properties": {}, | ||
"id": 0, | ||
"name": "AzureFunctions_CD - 3", | ||
"path": "\\", | ||
"projectReference": null, | ||
"_links": {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DarqueWarrior can you check if you agree? I thing it is a good approach because
A next step could be to remove the content types in all the other cmdlet so this problem does not occur anymore. We had this now the third time.