-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.ps1
56 lines (46 loc) · 1.59 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$ErrorActionPreference = "Stop"
if ($env:APPVEYOR_BUILD_VERSION) {
# run in CI
$version = $env:APPVEYOR_BUILD_VERSION -replace('\.[^.\\/]+$')
} else {
# run manually
[xml]$spec = Get-Content docker.nuspec
$version = $spec.package.metadata.version
}
"TEST: Version $version in docker.nuspec file should match"
[xml]$spec = Get-Content docker.nuspec
if ($spec.package.metadata.version.CompareTo($version)) {
Write-Error "FAIL: Wrong version in nuspec file!"
}
"TEST: Package should contain only install script"
Add-Type -assembly "system.io.compression.filesystem"
$zip = [IO.Compression.ZipFile]::OpenRead("$pwd\docker.$version.nupkg")
if ($zip.Entries.Count -ne 5) {
Write-Error "FAIL: Wrong count in nupkg!"
}
$zip.Dispose()
try {
. choco install -y docker -source .
Write-Error "FAIL: docker package could be installed"
} catch {
Write-Host "PASS: docker could not be installed as the dependency could not be found"
}
"TEST: Installation of package should work"
. choco install -y docker-cli -version 18.09.0
. choco install -y docker -source .
"TEST: Version of binary should match"
. docker --version
if (-Not $(docker --version).Contains("version 18.09.0,")) {
Write-Error "FAIL: Wrong version of docker installed!"
}
"TEST: Docker daemon shim must not exist"
if (Test-Path $env:ChocolateyInstall\bin\dockerd.exe) {
Write-Error "FAIL: Docker daemon shim exists!"
}
"TEST: Docker proxy shim must not exist"
if (Test-Path $env:ChocolateyInstall\bin\docker-proxy.exe) {
Write-Error "FAIL: Docker proxy shim exists!"
}
"TEST: Uninstall should work"
. choco uninstall docker
"TEST: Finished"