Skip to content

Commit 688f3a6

Browse files
committed
Import PS Security module before running a PS function
1 parent 07be14d commit 688f3a6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/workflows/windows.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ jobs:
44
integration_tests:
55
strategy:
66
matrix:
7-
go: ['1.20']
7+
go: ['1.22']
88
platform: [windows-latest]
99
runs-on: ${{ matrix.platform }}
10+
env:
11+
PSModulePath: C:\Windows\System32\WindowsPowerShell\v1.0\Modules
1012
steps:
1113
- name: Install Go
1214
uses: actions/setup-go@v4
@@ -22,7 +24,6 @@ jobs:
2224
run: |
2325
# required for running Volume and Disk tests
2426
Install-WindowsFeature -name Hyper-V-PowerShell
25-
2627
# start the CSI Proxy before running tests on windows
2728
Start-Job -Name CSIProxy -ScriptBlock {
2829
.\bin\csi-proxy.exe
@@ -35,7 +36,7 @@ jobs:
3536
unit_tests:
3637
strategy:
3738
matrix:
38-
go: ['1.20']
39+
go: ['1.22']
3940
platform: [windows-latest]
4041
runs-on: ${{ matrix.platform }}
4142
steps:
@@ -53,7 +54,7 @@ jobs:
5354
bump_version_test:
5455
strategy:
5556
matrix:
56-
go: ['1.20']
57+
go: ['1.22']
5758
platform: [ubuntu-latest]
5859
runs-on: ${{ matrix.platform }}
5960
steps:

integrationtests/smb_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ func randomString(length int) string {
3030
}
3131

3232
func setupUser(username, password string) error {
33-
cmdLine := fmt.Sprintf(`$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` +
33+
cmdLine := fmt.Sprintf(`Import-Module Microsoft.PowerShell.Security -RequiredVersion 3.0.0.0` +
34+
`;$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` +
3435
`;New-Localuser -name $Env:username -accountneverexpires -password $PWord`)
3536
cmd := exec.Command("powershell", "/c", cmdLine)
3637
cmd.Env = append(os.Environ(),

0 commit comments

Comments
 (0)