generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathutils.psm1
41 lines (33 loc) · 1.22 KB
/
utils.psm1
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
function Restart-CSIProxy {
# stop the csiproxy service
Get-Process csi-proxy | Stop-Process -Force
sc.exe stop csiproxy
Start-Sleep -Seconds 1;
sc.exe delete csiproxy
Start-Sleep -Seconds 1;
# copy the binary from the user directory
Copy-Item -Path "C:\Users\$env:UserName\csi-proxy.exe" -Destination "C:\etc\kubernetes\node\bin\csi-proxy.exe"
# restart the csiproxy service
$flags = "-v=5 -windows-service -log_file=C:\etc\kubernetes\logs\csi-proxy.log -logtostderr=false"
sc.exe create csiproxy start= "auto" binPath= "C:\etc\kubernetes\node\bin\csi-proxy.exe $flags"
sc.exe failure csiproxy reset= 0 actions= restart/10000
sc.exe start csiproxy
Start-Sleep -Seconds 5;
Write-Output "Checking the status of csi-proxy"
sc.exe query csiproxy
[System.IO.Directory]::GetFiles("\\.\\pipe\\")
Write-Output "Get logs"
Get-Content C:\etc\kubernetes\logs\csi-proxy.log -Tail 20
}
function Run-CSIProxyIntegrationTests {
param (
[string]$test_args = ""
)
$ErrorActionPreference = "Stop";
Write-Output "Running integration tests with test_args=$test_args";
$flags = $test_args.Split(" ");
.\integrationtests.test.exe @flags
if (-not $?) {
throw "failed to run with exit code=$?"
}
}