-
Notifications
You must be signed in to change notification settings - Fork 397
/
test.ps1
36 lines (32 loc) · 1.54 KB
/
test.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
function testCommand($image, $command, $expected) {
Write-Host "Testing: docker run $image $command --version"
$ErrorActionPreference = 'SilentlyContinue';
$allOutput = & docker run $image $command --version 2>&1
$stderr = $allOutput | ?{ $_ -is [System.Management.Automation.ErrorRecord] }
$actual = $allOutput | ?{ $_ -isnot [System.Management.Automation.ErrorRecord] }
$ErrorActionPreference = 'Stop';
Write-Host $actual
if ($LastExitCode) {
Write-Error "Command exited with error $LastExitCode : $stderr"
}
if ($expected -and ($actual -ne $expected)) {
Write-Error "Expected '$expected', but got '$actual'"
}
if ($actual -eq "") {
Write-Error "Expected some output, but got '$actual'"
}
}
function testVersion($majorMinorPatch, $yarnVersion) {
testCommand "node:$majorMinorPatch-windowsservercore" "node" "v$majorMinorPatch"
testCommand "node:$majorMinorPatch-windowsservercore" "npm.cmd" ""
testCommand "node:$majorMinorPatch-windowsservercore" "yarn.cmd" $yarnVersion
testCommand "node:$majorMinorPatch-windowsservercore" "git" "git version 2.17.1.windows.2"
testCommand "node:$majorMinorPatch-nanoserver" "node" "v$majorMinorPatch"
testCommand "node:$majorMinorPatch-nanoserver" "npm.cmd" ""
testCommand "node:$majorMinorPatch-nanoserver" "yarn.cmd" $yarnVersion
testCommand "node:$majorMinorPatch-nanoserver" "git" "git version 2.17.1.windows.2"
testCommand "node:$majorMinorPatch-pure" "node" "v$majorMinorPatch"
}
#testVersion "6.14.3" "1.6.0"
#testVersion "8.11.3" "1.6.0"
testVersion "10.8.0" "1.7.0"