forked from Azure/azure-webjobs-sdk-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.ps1
59 lines (46 loc) · 1.98 KB
/
run-tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function RunTest([string] $project, [string] $description,[bool] $skipBuild = $false, $filter = $null) {
Write-Host "Running test: $description" -ForegroundColor DarkCyan
Write-Host "-----------------------------------------------------------------------------" -ForegroundColor DarkCyan
Write-Host
$cmdargs = "test", ".\test\$project\", "-v", "q"
if ($filter) {
$cmdargs += "--filter", "$filter"
}
# We'll always rebuild for now.
# if ($skipBuild){
# $cmdargs += "--no-build"
# }
# else {
# Write-Host "Rebuilding project" -ForegroundColor Red
# }
& dotnet $cmdargs | Out-Host
$r = $?
Write-Host
Write-Host "-----------------------------------------------------------------------------" -ForegroundColor DarkCyan
Write-Host
return $r
}
$tests = @(
@{project ="WebJobs.Extensions.Tests"; description="Core extension Tests"},
@{project ="WebJobs.Extensions.Http.Tests"; description="HTTP extension tests"},
@{project ="WebJobs.Extensions.CosmosDB.Tests"; description="CosmosDB extension tests"},
@{project ="WebJobs.Extensions.MobileApps.Tests"; description="Mobile Apps extension tests"},
@{project ="WebJobs.Extensions.SendGrid.Tests"; description="SendGrid extension tests"},
@{project ="WebJobs.Extensions.Twilio.Tests"; description="Twilio extension tests"}
)
$success = $true
$testRunSucceeded = $true
# timer tests require Daylight Savings Time, so switch settings, then reset.
$originalTZ = Get-TimeZone
Write-Host "Current TimeZone: '$originalTZ'"
Set-TimeZone -Name "Pacific Standard Time"
$currentTZ = Get-TimeZone
Write-Host "Changing TimeZone for Timer tests. Now '$currentTZ'"
foreach ($test in $tests){
$testRunSucceeded = RunTest $test.project $test.description $testRunSucceeded $test.filter
$success = $testRunSucceeded -and $success
}
Set-TimeZone -Id $originalTZ.Id
$currentTZ = Get-TimeZone
Write-Host "Changing TimeZone back to original. Now '$currentTZ'"
if (-not $success) { exit 1 }