Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions contrib/cirrus/win-podman-machine-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,25 @@ $Env:TEMP = 'Z:\'
Write-Host "`nRunning podman-machine e2e tests"

if ($Env:TEST_FLAVOR -eq "machine-wsl") {
if ($Env:CIRRUS_CI -eq "true") {
# Add a WSL configuration file
# The `kernelBootTimeout` configuration is to prevent CI/CD flakes
# See
# https://github.com/microsoft/WSL/issues/13301#issuecomment-3367452109
Write-Host "`nAdding WSL configuration file"
$wslConfigPath = "$env:UserProfile\.wslconfig"
$wslConfigContent = @"
[wsl2]
kernelBootTimeout=300000 # 5 minutes
"@
Set-Content -Path $wslConfigPath -Value $wslConfigContent -Encoding utf8
wsl --shutdown
Write-Host "`n$wslConfigPath content:"
Get-Content -Path $wslConfigPath
}

# Output info so we know what version we are testing.
Write-Host "`nOutputting WSL version:"
wsl --version
Run-Command "$PSScriptRoot\win-collect-wsl-logs-start.ps1"
}
Expand Down
15 changes: 15 additions & 0 deletions pkg/machine/e2e/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ func setup() (string, *machineTestBuilder) {
if err := os.Setenv("USERPROFILE", homeDir); err != nil {
Fail("unable to set home dir on windows")
}
if testProvider.VMType() == define.WSLVirt {
// create file $USERPROFILE/.wslconfig
// https://github.com/microsoft/WSL/issues/13301#issuecomment-3367452109
wslconfig, err := os.Create(filepath.Join(homeDir, ".wslconfig"))
if err != nil {
Fail(fmt.Sprintf("failed to create wslconfig file: %q", err))
}
_, err = wslconfig.WriteString("[wsl]\nkernelBootTimeout=300000")
if err != nil {
Fail(fmt.Sprintf("failed to write wslconfig file: %q", err))
}
if err := wslconfig.Close(); err != nil {
Fail(fmt.Sprintf("failed to close wslconfig file: %q", err))
}
}
}
if err := os.Setenv("XDG_RUNTIME_DIR", homeDir); err != nil {
Fail("failed to set xdg_runtime dir")
Expand Down