diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 572e25e9..6dc969aa 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,10 +1,29 @@ name: Windows Tests on: [push, pull_request] jobs: + setup_powershell: + strategy: + matrix: + go: ['1.22'] + platform: [windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Run Windows Integration Tests + shell: powershell + run: | + # required for running Volume and Disk tests + Install-WindowsFeature -name Hyper-V-PowerShell + $PSVersionTable + # required for SMB test + # Get-PSRepository + # Set-PSRepository PSGallery -InstallationPolicy Trusted + Install-Module -Name SecMgmt -AllowClobber + $secured='random text'|ConvertTo-SecureString -AsPlainText -Force;$secured; + integration_tests: strategy: matrix: - go: ['1.20'] + go: ['1.22'] platform: [windows-latest] runs-on: ${{ matrix.platform }} steps: @@ -19,10 +38,12 @@ jobs: go build -v -a -o ./bin/csi-proxy.exe ./cmd/csi-proxy go build -v -a -o ./bin/csi-proxy-api-gen.exe ./cmd/csi-proxy-api-gen - name: Run Windows Integration Tests + shell: powershell run: | # required for running Volume and Disk tests Install-WindowsFeature -name Hyper-V-PowerShell - + + # start the CSI Proxy before running tests on windows Start-Job -Name CSIProxy -ScriptBlock { .\bin\csi-proxy.exe @@ -31,11 +52,12 @@ jobs: Write-Output "getting named pipes" [System.IO.Directory]::GetFiles("\\.\\pipe\\") $env:CSI_PROXY_GH_ACTIONS="TRUE" - go test -timeout 20m -v -race ./integrationtests/... + + go test -timeout 20m -v -race ./integrationtests/... -run "Smb" unit_tests: strategy: matrix: - go: ['1.20'] + go: ['1.22'] platform: [windows-latest] runs-on: ${{ matrix.platform }} steps: @@ -53,7 +75,7 @@ jobs: bump_version_test: strategy: matrix: - go: ['1.20'] + go: ['1.22'] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/integrationtests/smb_test.go b/integrationtests/smb_test.go index 65a359d4..71e013e9 100644 --- a/integrationtests/smb_test.go +++ b/integrationtests/smb_test.go @@ -32,7 +32,7 @@ func randomString(length int) string { func setupUser(username, password string) error { cmdLine := fmt.Sprintf(`$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` + `;New-Localuser -name $Env:username -accountneverexpires -password $PWord`) - cmd := exec.Command("powershell", "/c", cmdLine) + cmd := exec.Command("powershell", "-NonInteractive", "-NoProfile", cmdLine) cmd.Env = append(os.Environ(), fmt.Sprintf("username=%s", username), fmt.Sprintf("password=%s", password))