Skip to content

Replace go-shellwords with own shellescape.Split #120

Replace go-shellwords with own shellescape.Split

Replace go-shellwords with own shellescape.Split #120

Workflow file for this run

name: Integration
on: [pull_request]
jobs:
integration-test-linux:
strategy:
fail-fast: false
matrix:
image:
- quay.io/k0sproject/bootloose-ubuntu20.04
- quay.io/k0sproject/bootloose-debian12
- quay.io/k0sproject/bootloose-alpine3.18
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: install test dependencies
run: |
sudo apt-get update
sudo apt-get install expect
- name: Run integration tests
env:
LINUX_IMAGE: ${{ matrix.image }}
run: |
cd test
go mod download
make test
windows:
runs-on: windows-2022
steps:
- name: Set up WinRM
shell: pwsh
run: |
Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value $True
Get-ChildItem WSMan:\Localhost\listener | Remove-Item -Recurse
Set-Item -Path WSMan:\LocalHost\MaxTimeoutms -Value '1800000'
Set-Item -Path WSMan:\LocalHost\Shell\MaxMemoryPerShellMB -Value '1024'
Set-Item -Path WSMan:\LocalHost\Service\AllowUnencrypted -Value 'false'
Set-Item -Path WSMan:\LocalHost\Service\Auth\Basic -Value 'true'
Set-Item -Path WSMan:\LocalHost\Service\Auth\CredSSP -Value 'true'
New-NetFirewallRule -Name "WINRM-HTTPS-In-TCP" `
-DisplayName "Windows Remote Management (HTTPS-In)" `
-Description "Inbound rule for Windows Remote Management via WS-Management. [TCP 5986]" `
-Group "Windows Remote Management" `
-Program "System" `
-Protocol TCP `
-LocalPort "5986" `
-Action Allow `
-Profile Domain,Private
$Hostname = [System.Net.Dns]::GetHostByName((hostname)).HostName.ToUpper()
$pfx = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName $Hostname
$certThumbprint = $pfx.Thumbprint
$certSubjectName = $pfx.SubjectName.Name.TrimStart("CN = ").Trim()
New-Item -Path WSMan:\LocalHost\Listener -Address * -Transport HTTPS -Hostname $certSubjectName -CertificateThumbPrint $certThumbprint -Port "5986" -force
Restart-Service WinRM
$Username = "winrmuser"
$Password = ConvertTo-SecureString "Password123" -AsPlainText -Force
New-LocalUser -Name $Username -Password $Password -FullName "WinRM User" -Description "Local user for WinRM testing"
Add-LocalGroupMember -Group "Administrators" -Member $Username
$Credentials = New-Object System.Management.Automation.PSCredential ($Username, $Password)
# try it out:
$SessionOptions = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
$Session = New-PSSession -ComputerName "localhost" -Credential $Credentials -Authentication Basic -UseSSL:$true -SessionOption $SessionOptions
Invoke-Command -Session $Session -ScriptBlock { cmd.exe /c ver.exe }
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Unit test
run: |
go test -v ./...
- name: Integration test
run: |
cd test
go mod download
go test -v ./ -args -protocol winrm -host 127.0.0.1 -port 5986 -user winrmuser -winrm-password Password123 -winrm-https